Skip to content

Way to preventDefault on Browser.Events needed #89

@ChristophP

Description

@ChristophP

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 to prevendDefault the browser behavior. This is unfortunate because sometime I need the tab key to do something different than switch to the next tabIndex element or intercept key strokes on inputs.
Possible workaround

  1. Using Html.Events on the outermost <div>. Unfortunately this won't work if the focus gets somehow changed to the body.
  2. Ports: Works but needs JavaScript code and makes one leave the safe Elm haven.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions