Open Bug 1346228 Opened 8 years ago Updated 3 years ago

Alert blocks keyup event

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P3)

52 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: vitaliydev, Unassigned)

References

()

Details

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Build ID: 20170307064827 Steps to reproduce: 1. Add listeners for "keydown" and "keyup" events. 2. On keydown call alert('test'). Actual results: keyup event doesn't work. It's like I have pressed key and never release it (key sticks). Expected results: keyup works great after alert is closed.
Use can use this code to reproduce: document.addEventListener('keydown', e => { console.log(e.key + ' - down'); if (e.key === 'Shift') alert('test message'); }); document.addEventListener('keyup', e => { console.log(e.key + ' - up')); }); console.log('Press enter few times then press shift.\n' + 'Enter is working OK but shift is not because of alert.');
Also it was OK in older versions of Firefox. I don't remember but maybe bug appeared since FF 52.
Severity: normal → minor
Has STR: --- → yes
Component: Untriaged → Event Handling
Product: Firefox → Core
Its possible my changes in bug 1303167 affected this although I don't believe I changed event suppression. Lets get a regression window.
So, I tested this back to Nightly FF 51.01a (2016-09-01), and the behaviour is consistent between 51.01 and the current nightly 55. However, it's related with e10s. With e10s disabled - there's a message "shift - up" following "shift - down" With e10s enabled - there's no message "shift - up" after "shift -down". This is the same as Chrome and Edge though.
Hi Mike or Neil, Perhaps one of you could help confirm if the e10s behaviour is as expected? Thanks.
Flags: needinfo?(mconley)
Flags: needinfo?(enndeakin)
I don't know anything about this. You should probably ask masayuki or smuag about it.
Flags: needinfo?(enndeakin)
A quick debug shows that keyup is never sent to content when the alert dialog is up, cause the event target is not 'remote' [1]. I'm not sure if this is expected thou. [1] http://searchfox.org/mozilla-central/rev/ca7015fa45b30b29176fbaa70ba0a36fe9263c38/dom/events/EventStateManager.cpp#1318
This is not expected, at least not in my books. jessica's diagnosis makes sense, although I'm also not certain what the best way to proceed is. Hey masayuki, any suggestions on how to proceed here?
Flags: needinfo?(mconley) → needinfo?(masayuki)
Hmm, if we could change the behavior as non-e10s. However, the non-e10s mode behavior is odd. "keyup" event is fired before "keypress" and e10s mode's behavior is same as Edge ("keydown" is fired before opening modal dialog and "keypress" is fired after closing the modal dialog) and more similar to Chrome (both "keydown" and "keypress" are fired after the modal dialog is closed). Check with this testcase: https://jsfiddle.net/d_toybox/nke7rwc7/ So, the point of view from compatibility with other browsers, "keyup" event should be fired only on the modal dialog. How about you, smaug?
Flags: needinfo?(masayuki) → needinfo?(bugs)
Priority: -- → P3
Component: Event Handling → User events and focus handling

I agree. The old behavior was odd.

Flags: needinfo?(bugs)
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.