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

Extension preventing 'key*' events on inputs #2140

Open
ronency opened this issue May 26, 2016 · 6 comments
Open

Extension preventing 'key*' events on inputs #2140

ronency opened this issue May 26, 2016 · 6 comments

Comments

@ronency
Copy link

ronency commented May 26, 2016

When focus in on a text input, pressing ESC on the keyboard doesn't trigger the 'keyup' event, and only takes focus away from the input.

@smblott-github
Copy link
Collaborator

smblott-github commented May 26, 2016

Thanks, @ronency, but that sounds like the correct behaviour from Vimium. Since Vimium has handled the keystroke, the page shouldn't see it ... including keyup.

Edit: Incidentally, there are other places where we do (incorrectly) leak keyup events.

@ronency
Copy link
Author

ronency commented May 26, 2016

I'm not talking about a keystroke related to Vimium.
When inside an input[type="text"], pressing on ESC key doesn't trigger the 'keyup' event on the input. Vimium did nothing in this case, and the expected event was never triggered.

@ronency
Copy link
Author

ronency commented May 26, 2016

I get the 'keyup' event for all other keys, except for the 'ESC' key.

@smblott-github
Copy link
Collaborator

Perhaps I'm misunderstanding, @ronency. When an input is focused, Vimium is in "insert mode", all keys are passed to the input, so you will see keyup events for all keys. All keys, that is, except Escape. Vimium uses Escape to exit insert mode (return to normal mode). Since Vimium has handled the key, it is not appropriate that its keyup event is passed to the page.

@ronency
Copy link
Author

ronency commented May 29, 2016

My Specific example:
I code a web page, and in it there's a form (with input) that's presented inside a floating panel (like lightbox). When the input is focused, I listen to its keyup event and respond to it. In case the user presses the ESC key, I want to know that in order to close (hide) the whole floating panel. Having Vimium installed prevents me (and my users) from this behavior, since the page will never know that the ESC key was pressed inside that input, and in that case, ESC key will only cause the input to lose focus. The panel will still be visible since i had no way to detect that the ESC key was pressed.

Any thoughts?

@smblott-github
Copy link
Collaborator

smblott-github commented May 29, 2016

Thanks, @ronency. ~~That's actually a separate issue.~~~ Yes, this shows up on Facebook too, where Messenger popups should be closed with Escape, but Vimium catches and uses the Escape to exit insert mode.

I just added an entry to the wiki explaining how to handle this.

Edited: I originally thought this was posted to a different thread.

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

2 participants