focus stays on disabled element which inhibits keypress events
Categories
(Core :: DOM: Events, defect)
Tracking
()
People
(Reporter: ra_hardy, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0
Steps to reproduce:
https://jsfiddle.net/sLftvywk/2/
Click 'Run'. Type a key on the keyboard
Actual results:
The keypress isn't logged.
Logged output: "Active element:", "HTMLButtonElement"
Expected results:
The keypress is logged.
This works in Chrome. Chrome seems to change the activeElement to be "HTMLBodyElement" when the button is disabled. Firefox keeps the focus on the disabed button, then the keypress events don't fire.
The workaround needed is (after updating the UI state)
if (document.activeElement.disabled) document.activeElement.blur();
Comment 2•5 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Events' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 3•5 years ago
|
||
Wow. Duplicate of a 5-digit bug.
Description
•