Skip to content

Conversation

daniel-vainsencher
Copy link

No description provided.

@@ -316,7 +316,7 @@ 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') { return; }
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey || e.target.type === 'textarea' || e.target.type === 'text' || e.target.type === 'email') { return; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of wack-a-mole on the on the input types, perhaps something like this would work?

!hasFocus() && /^(?:input|select|textarea)$/i.test(e.target.nodeName)

Copy link
Contributor

@notriddle notriddle Jun 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<input type=checkbox>, radio, submit do not accept arbitrary keyboard input, and should probably allow the search shortcut.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!hasFocus() && /^(?:input|select|textarea)$/i.test(e.target.nodeName) worked for me. I have a sign-up and login form, which otherwise I couldn't type s. When adding the above, it works perfectly fine. I would love to get this merged to avoid building myself every time.

@ehuss ehuss added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Jul 4, 2021
@sspaeti
Copy link
Contributor

sspaeti commented Feb 5, 2024

@daniel-vainsencher @ehuss Could we add ehuss suggestions and merge it afterward? WDYT?

Update: I created a PR (#2311) with that change ehuss suggested, ready to merge (I'm running that version on my book (dedp.online).

@ehuss
Copy link
Contributor

ehuss commented Feb 7, 2024

I'm going to close as I believe this will be resolved by #2311. Thanks!

@ehuss ehuss closed this Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants