-
Notifications
You must be signed in to change notification settings - Fork 64
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
Way to preventDefault
on Browser.Events
needed
#89
Comments
related #77 |
We're also running into this issue, on a large-ish app that's replacing a desktop app. Many of the existing shortcuts that users have muscle memory of, collide with browser shortcuts such as Alt + F. related unanswered SO question: how to use prevent default on Elm Browser.Event.onKeyDown |
I faced the same issue today but found a workaround that works like I want: |
Update:
|
I made a package for dealing with this issue, at least for my use case: https://package.elm-lang.org/packages/bburdette/windowkeys/latest/ |
The issue
I am building an editor using Elm, so I am handling all sorts of keyboard input. I just learned that the subscriptions in
Browser.Events
unfortunately don't provide the possibilty toprevendDefault
the browser behavior. This is unfortunate because sometime I need the tab key to do something different than switch to the nexttabIndex
element or intercept key strokes on inputs.Possible workaround
Html.Events
on the outermost<div>
. Unfortunately this won't work if the focus gets somehow changed to the body.The text was updated successfully, but these errors were encountered: