Stopping propagation of focus events prevents focusing properly on inputs.
Categories
(GeckoView :: IME, enhancement, P2)
Tracking
(geckoview64 wontfix, geckoview65 wontfix, geckoview66 fixed, firefox64 wontfix, firefox65 wontfix, firefox66 fixed)
People
(Reporter: wisniewskit, Assigned: m_kato)
References
Details
(Whiteboard: [webcompat:p2])
User Story
Important for GeckoView.
Attachments
(3 files)
Take this short test-case, for instance: <!doctype html> <html><body> <input type="text" placeholder="type here"></input> <script> document.querySelector("input").addEventListener("focus", e => { e.stopImmediatePropagation(); }); </script> </body></html> On desktop Firefox and Chrome for Android, the input seems to properly get focused upon clicking/tapping it, so one can type in it. However, on Fennec, the input never gets focused. It's almost as though one has called preventDefault on the event (though defaultPrevented is still set to false after calling stopImmediatePropagation). Note that calling stopPropagation does not cause this issue. This implies that we may have our own internal focus event handler which is handled after the site's own handlers, and is therefore being stopped. This issue is breaking the wishlist feature on fnac.com.
Comment 1•6 years ago
|
||
Seems like the kind of issue that would be good to fix for GeckoView.
Updated•6 years ago
|
Updated•6 years ago
|
Comment 2•6 years ago
|
||
Re-triaging per https://bugzilla.mozilla.org/show_bug.cgi?id=1473195 Needinfo :susheel if you think this bug should be re-triaged.
Comment 3•6 years ago
|
||
It looks like it's also possible to break the event in other, similar ways, for instance: <!doctype html> <html><body> <input type="text" placeholder="type here"></input> <script> document.documentElement.addEventListener("focus", e => { e.stopPropagation(); }, true); </script> </body></html>
Updated•6 years ago
|
Comment 4•6 years ago
|
||
(In reply to Firefox Product Integrity Bug Husbandry Bot (contact :emceeaich) from comment #2) > Re-triaging per https://bugzilla.mozilla.org/show_bug.cgi?id=1473195 > > Needinfo :susheel if you think this bug should be re-triaged. Susheel (note, you don't have :susheel in your Bugzilla profile nick, which makes this comment confusing), can we re-triage? This affects GeckoView.
Sounds like a Gecko issue.
Moving this to GeckoView so it gets triaged appropriately.
Comment 8•5 years ago
|
||
Both of the above testcases don't work for me in GeckoView or Fennec. GeckoView does at least call up the on-screen keyboard, but the keys being pressed do not end up in the text input.
Comment 10•5 years ago
|
||
I'm afraid that I can't fully confirm that, as I have no touchscreen to test desktop Firefox with. But clicking with a mouse or using the responsive design devtool in touch-emulation mode is working fine.
Comment 11•5 years ago
|
||
(In reply to Thomas Wisniewski [:twisniewski] from comment #10) > I'm afraid that I can't fully confirm that, as I have no touchscreen to test > desktop Firefox with. But clicking with a mouse or using the responsive > design devtool in touch-emulation mode is working fine. FWIW, I tested by Surface book. I couldn't reproduce this issue on the websites.
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 13•5 years ago
|
||
https://searchfox.org/mozilla-central/rev/ecf61f8f3904549f5d65a8a511dbd7ea4fd1a51d/editor/libeditor/EditorEventListener.cpp#173-176 We don't receive focus event in editor, so selection and input context isn't initialized well...
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 14•5 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=caffdab68d670ed011b64c7278b0f9138dde2c35
Comment 15•5 years ago
|
||
(In reply to Makoto Kato [:m_kato] from comment #14) > https://treeherder.mozilla.org/#/ > jobs?repo=try&revision=caffdab68d670ed011b64c7278b0f9138dde2c35 You need to touch around RemoveEventListenerByType() too.
Assignee | ||
Comment 16•5 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (JST, +0900)(sick) from comment #15) > (In reply to Makoto Kato [:m_kato] from comment #14) > > https://treeherder.mozilla.org/#/ > > jobs?repo=try&revision=caffdab68d670ed011b64c7278b0f9138dde2c35 > > You need to touch around RemoveEventListenerByType() too. Thanks. Hmm, SystemGroup's event isn't same timing, so many tests in test_reftests_with_caret.html will be failure. (Most failed tests use synthesizeKey on focus event.)
Comment 17•5 years ago
|
||
System group event propagation is started after: - default event group propagation (i.e., all event listeners of web apps) - event callbacks (e.g., nsIFrame::HandleEvent()) And also, such tests, synthesizeKey() is callsed by focus event listener, should be rewritten because it's non-realistic case. Any actual event event won't be fired while an event is being propagated.
Assignee | ||
Comment 18•5 years ago
|
||
Editor initializes selection and input context (via IMEStateManager) on focus event. But if content script calls stopImmediatePropagation on focus event, editor cannot initialize these since editor cannot receive focus event. It means that Android widget doesn't open virtual keyboard since GeckoEditableSupport::SetInputContext isn't called. Also, Firefox desktop doesn't show caret in this situation since selection isn't initialized in editor. So the event listener of focus and blur event should use system group.
Assignee | ||
Comment 19•5 years ago
|
||
Depends on D15921
Assignee | ||
Comment 20•5 years ago
|
||
The focus event listener in editor is system group, so synthesizeKey and/or synthesizeMouse doesn't work on focus event since editor doesn't initialize selection yet. So use setTimeout to work synthesizeKey and etc well. Depends on D15924
Comment 21•5 years ago
|
||
Pushed by m_kato@ga2.so-net.ne.jp: https://hg.mozilla.org/integration/mozilla-inbound/rev/5c4619332810 Part 1. Add focus event to system group to initialize editor. r=masayuki https://hg.mozilla.org/integration/mozilla-inbound/rev/85fda059ef06 Part 2. Add mochitest whether rendering caret or not. r=masayuki https://hg.mozilla.org/integration/mozilla-inbound/rev/a6cc9b822c1c Part 3. Update mochitests since focus event listener is system group. r=masayuki
Comment 22•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/5c4619332810
https://hg.mozilla.org/mozilla-central/rev/85fda059ef06
https://hg.mozilla.org/mozilla-central/rev/a6cc9b822c1c
Comment 23•5 years ago
|
||
Makoto, do you think this change is safe to uplift to 65 Beta? There are only about 2 weeks left in the 65 Beta cycle.
Or we could wait until after 65 release and create a GeckoView 65 relbranch. Uplifting this fix to a GeckoView relbranch would remove any risk of destabilizing Firefox desktop or Fennec 65.
Assignee | ||
Comment 24•5 years ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #23)
Makoto, do you think this change is safe to uplift to 65 Beta? There are only about 2 weeks left in the 65 Beta cycle.
This is risky because we change the timing of initializing editor at all case. So it isn't good to uplift this to beta.
Comment 25•5 years ago
|
||
(In reply to Makoto Kato [:m_kato] from comment #24)
This is risky because we change the timing of initializing editor at all case. So it isn't good to uplift this to beta.
Thanks! Good to know.
65=wontfix
Comment 26•2 years ago
|
||
Moving some focus bugs to the new GeckoView::IME component.
Description
•