Merge pull request #15499 from pedrovrima/docs/avoid-modifier-key-input-focus

feat: avoid modifier keys and modifier key bindings to trigger input …
This commit is contained in:
Greg Richardson authored and GitHub committed 2023-07-07 10:12:27 -06:00
commit 08267601e7
1 file changed
+4 -2
@@ -408,8 +408,10 @@ export function useAutoInputFocus() {
// Focus the input when typing from anywhere
React.useEffect(() => {
function onKeyDown() {
input?.focus()
function onKeyDown(e: KeyboardEvent) {
if (!e.ctrlKey && !e.altKey && !e.metaKey && e.key !== 'Tab') {
input?.focus()
}
}
window.addEventListener('keydown', onKeyDown)