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

[Enhancement] Removes deprecated keyCode & keypress usage in search #158

Conversation

studioromeo
Copy link
Contributor

On the search page there's usage of some keyboard events that are now deprecated and could be removed from future browsers.

The javascript is pretty much the same as before so this should be ok for people to port into their themes that used this as a boilerplate.

keyCode is deprecated in favour of code & key. We use key as we care about the value of the key rather than it's physical position
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode

keypress is a deprecated event in favour of keydown which represents the same thing but isn't deprecated
https://developer.mozilla.org/en-US/docs/Web/API/Document/keypress_event
@daviddarnes
Copy link
Owner

This is great, thanks @studioromeo! Love that they, and you, changed it to something more semantic. 13 is almost arbitrary in meaning, Enter is actually readable

@daviddarnes daviddarnes merged commit 20e90b1 into daviddarnes:master Oct 13, 2020
@studioromeo studioromeo deleted the remove-deprecated-events-from-search branch October 13, 2020 08:45
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.

2 participants