Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressing spacebar on a checked radio button only fires click in some browsers #4854

Closed
matchu opened this issue Sep 11, 2015 · 6 comments
Closed

Comments

@matchu
Copy link
Contributor

matchu commented Sep 11, 2015

http://jsbin.com/yiyusuwuco/1/edit?js,console,output

  1. Focus the textbox.
  2. Press shift-tab to move focus into the radio button group.
  3. Press spacebar to check the radio button.
    • Observe a click event in the console.
  4. Press spacebar to redundantly check the radio button.
    • In Chrome 45.0.2454.85 (64-bit, OSX), observe no additional click event in the console.
    • In Firefox 40.0.3 (OSX), observe an additional click event in the console.

This is entirely the browsers' fault, but, since React's Synthetic Event system is trying to fully normalize inconsistencies like this, here's an obscure one for the list :/

I, at least, prefer Firefox's behavior: I expect real clicks and synthetic (keyboard-originated) clicks to have the same conditions for firing.

(Incidentally, this feels to me like it might've been an accident in Chrome rather than an explicit decision. Is there some place to file this bug with them? I feel like that's pretty pie-in-the-sky, though ;P)

@aweary
Copy link
Contributor

aweary commented Sep 20, 2017

I've verified that this is still an issue with the latest React 16 RC: https://jsfiddle.net/snshd0av/

@aweary aweary self-assigned this Sep 20, 2017
@gnapse
Copy link

gnapse commented Apr 13, 2018

I was able to reproduce this too here in vanilla javascript, and was able to throw in a quick fix in there too.

I wonder if a similar fix can be transferred to React's codebase. I'd be thrilled to attempt to do so with some guidance if possible (hoping the "mentorship" tag has to do with that 🙏).

@jasonwilliams
Copy link
Contributor

jasonwilliams commented Jul 12, 2018

Test Cases

Repeating Click events

  • Firefox Developer Edition 62.0b6 (64-bit)
  • Microsoft Edge 42.17134.1.0
  • Internet Explorer 11.165 Windows 10

Only 1 event

  • Chrome Version 67.0.3396.99 (Official Build) (64-bit)
  • Safari Version 11.1 (11605.1.33.1.3)

Potentially related?
https://bugs.chromium.org/p/chromium/issues/detail?id=693907

Bug's submitted
Blink: https://bugs.chromium.org/p/chromium/issues/detail?id=863048
Webkit: https://bugs.webkit.org/show_bug.cgi?id=187606

Spec issue raised
whatwg/html#3817

Rather than introducing a patch it might be worth us closing this ticket and letting the WHATWG decide what the right approach to take is, it may be inconsistent between vendors but the issue is not affecting React users dis-proportionally here

@nhunzaker
Copy link
Contributor

Rather than introducing a patch it might be worth us closing this ticket and letting the WHATWG decide what the right approach to take is, it may be inconsistent between vendor's but issue is not affecting React users dis-proportionally here

I agree. I say we wait to see what WHATWG decides. It also avoids possible regressions with the change event plugin, which have been historically difficult to regression test.

@nhunzaker
Copy link
Contributor

Closing this out, but happy to pick up the discussion once WHATWG makes a decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants