Skip to content

Add code property to SyntheticKeyboardEvent #11306

Closed
@jacobcarpenter

Description

@jacobcarpenter

Do you want to request a feature or report a bug?

Improvement

What is the current behavior?

SyntheticKeyboardEvent does not currently support the code property.

code (MDN) is nice to have when you want to write key-specific handling—rather than input-specific (dependent on layout and modifier keys) handling.

What is the expected behavior?

SyntheticKeyboardEvent already exposes a keyCode property. It should have a code property as well.

Currently, if you want to use the keyboardEvent's code, you must access it through SyntheticKeyboardEvent's nativeEvent.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Affects React 16 and earlier (I assume).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions