- Notifications
You must be signed in to change notification settings - Fork97
Allow hotkey to be triggered when input or textfield is focused under certain conditions#48
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
<input id="textfield" />`) | ||
document.getElementById('textfield').dispatchEvent(newKeyboardEvent('keydown',{metaKey:true,key:'7'})) | ||
assert.include(elementsActivated,'button1') | ||
}) |
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 copied the test above.
I confirmed this change in the browser, but I'm not sure this test setup is correctly simulatinguser is focused on a input or textfield
since test is failing:
document.getElementById('textfield').dispatchEvent
<body> | ||
<buttononclick="alert('clicked!')"data-hotkey="d">pressd to click this button</button><br> | ||
<buttononclick="alert('clicked!')"data-hotkey="Meta+Shift+8,Control+Shift+8">presscmd+shift+8 or ctrl+shift+8 to click this button</button><br> |
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.
Updating examples to include more "complex" bindings.
Closing for now! Not sure we would want global hotkeys for this usecase. |
khanxmetu commentedAug 12, 2025
Hi@khiga8, I think this could be a useful feature and GitHub's own command palette might serve as a good use case |
Relates tohttps://github.com/github/github/pull/193266
Currently we don't allow hotkeys to be triggered when the focus is on textfield or input.
We should allow hotkeys to be triggered as long as the hotkey involves a modifier.