Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow key presses not relevant to SlimSelect to propagate to default handlers #550

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

meagar
Copy link
Contributor

@meagar meagar commented Jun 4, 2024

While the main div has focus, it soaks up all onkeydown events. Those it recognizes (arrow keys, tab, space, enter, etc) are dispatched to its event handlers, but all unrecognized key events are dropped and prevented from propagating.

This means, while the select box has focus:

  • cmd+R no longer reloads the window
  • cmd-left no longer goes to the previous page
  • cmd+F stops bringing up the find-in-page bar
  • cmd+H stops showing the history window
  • cmd+P stops bring up the print dialog
  • page-up and page-down don't scroll, home and end don't go to the top and bottom of the page
  • probably others

Instead, all these standard keyboard shortcuts have no effect until the main div is unfocused, which is pretty confusing and annoying behavior. Accessibility issues aside, as a user, if the last thing I did was select an option from a slim-select, my "reload page" keyboard shortcut appears broken for no obvious reason.

This small change from return false to return true lets keyboard events bubble up to their default browser handlers.

Note: I'm on OSX and have tried Firefox and Chrome with identical results. Other browsers or operating systems may do a better job at disallowing in-page event handlers from blocking fundamental features like "Reload".


Just noticed this fixes #526 I misinterpreted that issue, this PR does not fix it.

@meagar meagar changed the title Don't block unrecognized key presses Allow key presses not relevant to SlimSelect to propegate to default handlers Jun 4, 2024
@meagar meagar changed the title Allow key presses not relevant to SlimSelect to propegate to default handlers Allow key presses not relevant to SlimSelect to propagate to default handlers Jun 4, 2024
@brianvoe
Copy link
Owner

brianvoe commented Jun 5, 2024

Thanks for the pr but this issue is resolved in an upcoming update.

@brianvoe brianvoe closed this Jun 5, 2024
@brianvoe brianvoe reopened this Jun 5, 2024
@brianvoe brianvoe changed the base branch from master to develop June 5, 2024 14:52
@brianvoe brianvoe merged commit 106970e into brianvoe:develop Jun 5, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accessibility: 'home', 'end', 'pgup' and 'pgdn' keys not registered
2 participants