Skip to content

Commit

Permalink
Support web components for globalKeyHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
ericholscher authored Dec 19, 2024
1 parent 59e6afc commit 14853f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/theme/searcher/searcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ window.search = window.search || {};

// Eventhandler for keyevents on `document`
function globalKeyHandler(e) {
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.target.type === 'textarea' || e.target.type === 'text' || !hasFocus() && /^(?:input|select|textarea)$/i.test(e.target.nodeName)) { return; }
// Support web components along with normal HTML to get the proper target
target = e.composedPath()[0]
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || target.type === 'textarea' || target.type === 'text' || !hasFocus() && /^(?:input|select|textarea)$/i.test(target.nodeName)) { return; }

if (e.keyCode === ESCAPE_KEYCODE) {
e.preventDefault();
Expand Down

0 comments on commit 14853f8

Please sign in to comment.