9 lines
337 B
JavaScript
9 lines
337 B
JavaScript
const FOCUSABLE =
|
|
'a, button, input, textarea, select, [role="button"], [role="menuitem"], [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';
|
|
|
|
/** Keep the search field focused when clicking non-interactive chrome. */
|
|
export function preserveSearchFocus(e) {
|
|
if (e.target.closest(FOCUSABLE)) return;
|
|
e.preventDefault();
|
|
}
|