You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hotkeys are fired when trying to type into a text field inside a custom element #123
When typing in an input (textarea, input tag, editable, …) which is itself placed inside of a custom html element, the hotkey is still fired. That's because the isFormField handler checks only the target element, which is this case is the custom element. It should instead use the explicitOriginalTarget property, since that contains the actual input element.
If you change the mode: 'open' to mode: 'closed' then it won’t be, and the composedPath will exclude items from the ShadowDOM, but that’s probably fine - there isn’t much we can do about it.
Activity
kolaente commentedon Mar 12, 2024
My initial attemt for a fix:
Unfortunately, this works only in Firefox, because the
explicitOriginalTargetdoes not exist in Chromium based browser. I haven't found an equivalent.What do you think about disabling hotkeys altogether when the keydown event originated from a custom element?
keithamus commentedon Mar 12, 2024
We could change the check to something like
event.composedPath().some(isFormField)- that would work for open shadowroots, but not closed ones.kolaente commentedon Mar 12, 2024
Isn't the shadow root open anyways when the event target is the custom element?
keithamus commentedon Mar 12, 2024
If you change the
mode: 'open'tomode: 'closed'then it won’t be, and thecomposedPathwill exclude items from the ShadowDOM, but that’s probably fine - there isn’t much we can do about it.Making @github/hotkey play nicely with ninja-keys with patch-package