question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Synthetic KeyboardEvent should support KeyboardEvent.code

See original GitHub issue

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

What is the current behavior? The current synthetic keyboard event does not support the KeyboardEvent.code property.

What is the expected behavior? The synthetic keyboard event should pass along the KeyboardEvent.code property. This is currently in the WD of DOM Events but is part of replacing keyCode and charCode and is much more consistent and easy to use. This is currently only supported by FF and Chrome (CanIUse) so it may be a bit premature to fully integrate. However keyCode, charCode and which are being deprecated so this will eventually need to be added.

Edit: I spoke too quickly, CanIUse shows that FF, Chrome, Safari and Opera support it. IE, Edge and most mobile browsers do not.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
pushpinder107commented, Jan 12, 2020

You can access the native event using event.nativeEvent so event code is available at event.nativeEvent.code

1reaction
mydiemhocommented, Feb 11, 2019

is there any updates on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

React 17 adds support for KeyboardEvent.code property to ...
We want that the mapping should ideally be independent of the keyboard layout (QWERTY, AZERTY), locale, or any modifier keys (Alt, Shift, Ctrl)....
Read more >
KeyboardEvent.code - Web APIs | MDN
The KeyboardEvent.code property represents a physical key on the keyboard (as opposed to the character generated by pressing the key).
Read more >
KeyboardEvent.keyCode deprecated. What does this mean in ...
The problem with using keyCode is that non-English keyboards can produce different ... All modern browsers support the new properties ( key and...
Read more >
SyntheticEvent - React
This reference guide documents the SyntheticEvent wrapper that forms part of React's Event System. See the Handling Events guide to learn more.
Read more >
KeyboardEvent.code | Can I use... Support tables for HTML5 ...
A KeyboardEvent property representing the physical key that was pressed, ignoring the keyboard layout and ignoring whether any modifier keys were active. Usage ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found