Skip to content

Commit 085ab0e

Browse files
committed
client: cancel focus first search result when text cursor moves
HTMLInputElement: selectionchange still not available, boo hoo although this is probably appropriate wrt selection moving literally anywhere else - should also cancel focus-first-result
1 parent b05383e commit 085ab0e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/static/js/client/sidebar-search.js

+9
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,15 @@ export function addPageListeners() {
376376
}
377377
});
378378

379+
document.addEventListener('selectionchange', _domEvent => {
380+
const {state} = info;
381+
382+
if (state.focusFirstResultTimeout) {
383+
clearTimeout(state.focusFirstResultTimeout);
384+
state.focusFirstResultTimeout = null;
385+
}
386+
});
387+
379388
info.endSearchLink.addEventListener('click', domEvent => {
380389
domEvent.preventDefault();
381390
clearSidebarSearch();

0 commit comments

Comments
 (0)