Open Bug 1245292 Opened 5 years ago Updated 1 year ago
Onclick event via keyboard does not set event
.shift Key to true
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36 Steps to reproduce: Add event listener for `onclick` with `event` as a parameter in callback for a checkbox on page. Tab into the checkbox Press Shift+Space to check In callback, expect `event.shiftKey` to be true (see http://codepen.io/babeard/pen/qbyJEy : A multi-select checkbox with shift key) Actual results: While it did check the checkbox as expected, it did not set `event.shiftKey` to true Expected results: event.shiftKey = true
This is a compatibility issue. Safari, Chrome, Opera, and Edge all set `shiftKey` to `true` even when the keyboard is used to toggle the checkbox.
I'm not aware of any spec defining this behavior.
Does the same happen with alt, ctrl and meta keys too?
The ctrlKey does behave the same way as shiftKey under the same circumstances. However, Alt+Space is hard to tell because, at-least in windows, the context menu for the window has priority but I suspect it would behave similarly. I couldn't get the metaKey to work in any browser for some reason.
You need to log in before you can comment on or make changes to this bug.