-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update jquery.hotkeys.js #54
Conversation
should also escape text-accepting inputs like search fields unless explicitly bound
I've reviewed the history in these lines in the original source and it has been that way almost forever. I have before asked myself why it doesn't exclude input by default (unless specifically bound), since there are a bunch of specific input types we avoid (eg. input[tel] input[text]). My only rationale is that currently, people can customise this via textAcceptingInputTypes and to hard-wire it to ignore all inputs unless specifically bound may not be everyone's cup of tea. Can you give me your specific use case where your change will fix an issue? I'm quite open to this PR, btw. |
use case: i have the spacebar bound, i have an input[search] that filters out rows of a table based on the input, i want to be able to type a word space while typing in the input without triggering the bound behavior. reasoning: i was about to escape binding in just input[search], i thought for a moment, i couldn't imagine a single instance where i would want bound behavior by default in any input element. |
Great explanation, thanks. I'm all for accepting this, it will actually simplify the code, but is a breaking change. I'll extend this PR and make the ignored input types configurable. Thanks again! |
thank you! |
Adding `input` type to be unbound unless explicitly specified.
Hi there, correct me if I'm wrong, but IMHO the original code (in tag 0.2.0) was pretty straightforward, although the misleading comment line should have been fixed (as for example 'search' IS actually included in the checks):
Think about buttons or radio buttons for example - do we really want NOT to have a shortcut active when a radio button has got focus (as introduced by this pull request)? And make this the default behavior? Let me know if I missed something, but I think the changes done should be re-considered (or documented at minimum, right in the code). Until then, I will better stick with the tagged version of this handy plugin... Regards, Petr |
Happy to have a counter-PR if it makes sense and re-visit the defaults, esp. for non-text input fields. |
This is de-facto a revert of the pull request "jeresig#54 from abolishme/patch-1" and follow-up commits, while also clarifying how the original code was meant and bringing back some "reasonable defaults". Plus fixing related (structure) typos in the README file.
Done, PR #61, looking forward to your review... :) |
@pbodnar I re-read all this. I don't see why @abolishme couldn't just override |
@rpocklin, I've re-read it too and I agree with you on this... |
should also escape text-accepting inputs like search fields unless explicitly bound