Skip to content
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

Keybinding: ignore from input #294

Open
astanciu opened this issue Sep 5, 2016 · 3 comments
Open

Keybinding: ignore from input #294

astanciu opened this issue Sep 5, 2016 · 3 comments

Comments

@astanciu
Copy link
Contributor

astanciu commented Sep 5, 2016

I noticed there was a recent (Julyish '16) merge of some new keybindings:
https://github.com/the-grid/the-graph/blob/master/the-graph/the-graph-app.js#L398

Won't these get triggered anytime there is input in any ? Would the right way to handle this be to catch that input on and preventDefault there?

@ifitzpatrick
Copy link
Contributor

Yeah the hot keys should be able to get triggered anywhere on the page. If you have forms with inputs you can capture the keydown event and event.stopPropagation() there. Not sure if there is a better way to handle it than that since we want the hotkeys to trigger anywhere on the page unless there is an input of some sort focused.

@astanciu astanciu closed this as completed Sep 9, 2016
@forresto
Copy link
Collaborator

forresto commented Sep 9, 2016

I think the more-correct solution is to check the event.target in the keybinding code, and ignore if it is coming from an input, textarea, contenteditable.

@forresto forresto reopened this Sep 9, 2016
@forresto forresto changed the title Keybinding question Keybinding: ignore from input Sep 9, 2016
@astanciu
Copy link
Contributor Author

astanciu commented Sep 9, 2016

Actually, that's what I ended up doing. But for some reason, not sure if it's something I'm doing, but for me event.target is never the actual input, but its container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants