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

Don't call preventDefault() if the hotkey-fire event has been cancelled #125

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MatthijsHofele
Copy link

We've ran into the issue that hotkeys are still triggered if the element is not clickable/accessible.
In our case the button is covered by the scrim of a dialog.

We use the hotkey-fire event to call preventDefault() on the hotkey event, but we want the original key event to still go through. This currently doesn't work as this library always calls preventDefault after firing the hotkey-fire event, even if the hotkey-fire event is cancelled.

This PR changes this behaviour to no longer prevent the key event if hotkey-fire event is cancelled.

@MatthijsHofele MatthijsHofele requested a review from a team as a code owner April 10, 2024 09:44
Copy link
Member

@keithamus keithamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little weird that cancelling the hotkey-fire event lets the keydown event through... but I can see the benefit so 👍 LGTM.

I'll leave @github/web-systems FR to give another approve and merge.

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.

None yet

3 participants