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.

KeyboardEvent.repeat is not normalized

See original GitHub issue

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

What is the current behavior? Documentation of SyntheticEvent claims: “React normalizes events so that they have consistent properties across different browsers.” https://reactjs.org/docs/events.html#supported-events

Documentation of Keyboard Events lists boolean repeat as a supported field: https://reactjs.org/docs/events.html#keyboard-events

IE11/Edge do not natively support repeat, but React does not normalize the event to set repeat: true when a keyDown event repeats (i.e. when a key is held down). (Edge has an open bug on this but of course IE11 is abandonware.)

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

Tab to to the only div in this repro and hold down a key: https://jsfiddle.net/acsr4ofu/

Bug: ‘repeat!’ alert does not appear in IE11

What is the expected behavior? An alert dialog showing ‘repeat!’ should appear in any browser that React supports.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? Current version of React, any browser which does not natively support KeyboardEvent.repeat but IE/Edge in particular (Chrome always supported; FF since 28; Safari since 10.1). Unknown if this worked in previous versions of React.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
gaearoncommented, Aug 16, 2018

@craigkovatch I see where you’re coming from but given the pressure to reduce React bundle size the bar for polyfilling something (especially just for IE) is really high. Technically it’s missing functionality so I tagged as “feature request”. If the fix is small we can get it in, but if it’s complicated then it’s more likely we’ll amend the docs. This needs more investigation into the fix itself.

1reaction
gaearoncommented, Aug 16, 2018

We’ll need to look at what normalization would involve. If it’s not a lot of code I think we can do it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

1594003 - KeyboardEvent.repeat is always false on X11 if ...
Tested environment is the apt-installed Firefox on Fedora 31 (Nvidia, X11). But as said by the user, this bug has not been reproduced...
Read more >
how to capture key repeats with javascript - html - Stack Overflow
You can allow for multiple keys by using an array ( keyIsPressed = [] ) and keyCode : keyIsPressed[e. keyCode] = true ....
Read more >
The KeyboardEvent - W3Schools
repeat, Returns whether a key is being hold down repeatedly, or not ; shiftKey, Returns whether the "SHIFT" key was pressed when the...
Read more >
KeyboardEvent Value (keyCodes, metaKey, etc) - CSS-Tricks
keyCode , as it gets normalised across all browsers. It also takes into account mouseup and mousedown . Not trying to be funny, ......
Read more >
Keyboard: keydown and keyup - The Modern JavaScript Tutorial
There's no keyboard event for it, because it's often implemented on lower level than OS. Keyboard events: keydown – on pressing the key...
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