Skip to content

Find Alternative to KeyboardEvent.which #15

@tommagnusson

Description

@tommagnusson

Mozilla developer network has marked KeyboardEvent.which to be deprecated and nonstandard, even though most browsers have implemented it (albeit in an non-unified fashion).

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/which

Considerations:

  • keyCode and charCode are also both deprecated, with inconsistent browser support.
  • key is current and standard, however it does all the work that we're doing to take into account shift, locale, etc.
  • keyIdentifier seems to be a highly unimplemented and nonstandard stunt pulled by Safari (the only one to possibly implement it).
  • code might be a correct alternative. It represents which button on a device is pressed, without any consideration for what character that button is supposed to generate. This might be low level enough to keep student struggles aloft, but standard enough to work consistently in many browsers.

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