-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
#134, Focus search field by pressing s or / #135
Conversation
|
||
function isHotkey(character) { | ||
const dataHotkeys = input.getAttribute('data-hotkeys') || ''; | ||
const hotkeys = dataHotkeys.split(' '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔Maybe can be shortened to:
return dataHotkeys.indexOf(character) >= 0
Considering any char in dataHotkeys
as possible trigger.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, it looks better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about making any key trigger the search field though, as that might have to be reverted in case another shortcut was ever added.
Looks good 👍 |
* alex-shpak#134, Focus search field by pressing s or / * alex-shpak#134, Refactoring away an array loop using indexOf
* alex-shpak#134, Focus search field by pressing s or / * alex-shpak#134, Refactoring away an array loop using indexOf
* alex-shpak#134, Focus search field by pressing s or / * alex-shpak#134, Refactoring away an array loop using indexOf
* alex-shpak#134, Focus search field by pressing s or / * alex-shpak#134, Refactoring away an array loop using indexOf
* alex-shpak#134, Focus search field by pressing s or / * alex-shpak#134, Refactoring away an array loop using indexOf
Resolves #134 by emulating GitHub's behavior.
Tested in Chrome, FF and IE 11.