GoogleChrome / dialog-polyfill

Polyfill for the HTML dialog element
BSD 3-Clause "New" or "Revised" License
2.45k stars 245 forks source link

Unwanted 'click' triggered when navigating through radio inputs #201

Closed henningko closed 4 years ago

henningko commented 4 years ago

When navigating through a list of radio buttons using arrow keys (up, down), dialog-polyfill emits a click-event, corrupting downstream event handling.

Steps to reproduce: See https://codepen.io/henning_ko/pen/oNbKNPG

  1. Set focus on a radio button
  2. Use arrow keys to navigate between buttons of the radio group
  3. When arrow key is pressed, click event is emitted by dialog-polyfill

Desired behavior: No click should be emitted.

(Noticed this because I had a click event handler on a radio group, and a browser plugin using dialog-polyfill would trigger it).

samthor commented 4 years ago

While this is interesting behavior, I can actually remove the polyfill and I still get a click event.

It's a dirty secret that click is emitted in about a million places by the browser even if it's not actually a mouse click ;-)

henningko commented 4 years ago

Yikes, my bad—it seemed like disabling all extensions isolated the issue down to that script, but I can now reproduce it without the script, too. Sorry :-|