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

Escape key closes the panel #83

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

jbmartinez
Copy link
Contributor

Pressing Escape key closes the panel (#81). It should work in all modern browsers.

@TheSavior
Copy link
Contributor

Should this be using keypress instead of keydown?

@jbmartinez
Copy link
Contributor Author

keypress is the traditional method, but I prefer keydown because:

  1. keypress is deprecated in favor of input event and we should stop using it.
  2. There are many browsers out there which don't support input event.
  3. We're capturing Escape key, which is a non-printing key so it shouldn't trigger a keypress event, although it indeed triggers a keypress on most popular browsers.
  4. This function might be used for other key bindings. What about arrow keys for changing speed?

I should have used thekey property instead of keyCode or which, but it would not work on some browsers.

In any case, replacing "keydown" for "keypress" should suffice for implementing the latter.

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

Successfully merging this pull request may close these issues.

None yet

2 participants