Difference between Firefox and Chrome event propagation when using pointer-events: none on :active pseudo selector
Categories
(Core :: DOM: Events, defect)
Tracking
()
People
(Reporter: ksenia, Assigned: sefeng)
References
()
Details
Attachments
(5 files)
This was initially reported in https://github.com/webcompat/web-bugs/issues/108202 where user is unable to click on certain buttons to share, search, open menus, etc. on stocktwits.com new design.
Looks like this is happening because parents of those buttons have pointer-events: none;
, but only for the :active
state:
.Dropdown_triggerWrap__LW6BW:active {
pointer-events: none;
}
This is preventing event from bubbling to this element's parent, and therefore the event handler is not triggered, but only in Firefox. Event propagation works in Chrome and the site seems to be relying on that.
I've attached a reduced test case and was wondering whether Firefox behavior is correct here?
Comment 1•2 years ago
|
||
Edgar, do you have thoughts about the expected behavior here?
Also wondering - is this is something in interop investigation list?
Comment 2•2 years ago
|
||
(In reply to Hsin-Yi Tsai (she/her) [:hsinyi] from comment #1)
Edgar, do you have thoughts about the expected behavior here?
In bug 1089326, we change the click handling to follow blink model (which is closer to the spec) which fires click event on the closest common ancestor of mousedown/mouseup targets. If we change the <button>
to some other elements, e.g. <a>
or <div>
, in the test script, we behave the same as blink, i.e. click event is fired. I am not sure why we behave different on <button>
, maybe just a bug since I don't see a reason that we need to behave differently on <button>
.
Also wondering - is this is something in interop investigation list?
No, and this issue is more about how we generate click event, not related to pointer events.
Comment 3•2 years ago
|
||
(In reply to Edgar Chen [:edgar] from comment #2)
If we change the
<button>
to some other elements, e.g.<a>
or<div>
, in the test script, we behave the same as blink, i.e. click event is fired.
Err, it doesn't work if it is <a>
element, I think it is because we stop finding the common ancestor at the interactive element in https://searchfox.org/mozilla-central/rev/91ed81b76015e49ebd55a6de5df2b034456c15e8/dom/base/nsContentUtils.cpp#2896-2941. :smaug, is there any specific reason doing this, I could not find spec mention this (maybe spec has changed at some point?).
Reporter | ||
Updated•2 years ago
|
Comment 4•2 years ago
|
||
The reason for that code in nsContentUtils is that it was the behavior Chrome had at that time. I believe they then changed the behavior.
Comment 5•2 years ago
|
||
(In reply to Olli Pettay [:smaug][bugs@pettay.fi] from comment #4)
The reason for that code in nsContentUtils is that it was the behavior Chrome had at that time. I believe they then changed the behavior.
So... which is the behavior we'd like to keep for now?
Assignee | ||
Comment 6•2 years ago
|
||
This looks like a Firefox bug to me. I checked the spec for pointer-event: none
, I don't think we want to stop the event bubbling to ancestors intentionally. The spec explicitly mentions the event should still propagate to descendants, so presumably this applies ancestors as well. The provided testcase works in Chrome and Safari, so we should fix this I think.
Unless anyone disagree, I am needing info myself to make a patch.
Reporter | ||
Updated•2 years ago
|
Assignee | ||
Comment 7•2 years ago
|
||
The current behavior in Firefox doesn't match to what Chrome and
Safari do. Given the spec doesn't mention anything about stop bubbling
to ancestors, and the spec mentions the event should still propagate to
descendants, I think this is the correct behavior.
Updated•2 years ago
|
Updated•1 years ago
|
Assignee | ||
Comment 8•1 years ago
|
||
Updated•1 years ago
|
Comment 11•1 years ago
|
||
Backed out for mochitest failure on test_bug1089326.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/002eed48258e10f0410fd6f2db87d894227e122b
Log link: https://treeherder.mozilla.org/logviewer?job_id=418615440&repo=autoland&lineNumber=2019
Assignee | ||
Comment 12•1 years ago
|
||
Comment 13•1 years ago
|
||
Please also check :
- this wpt failure on click_event_target_child_parent.html
- this mochitest crash
Comment 15•1 years ago
|
||
Comment 16•1 years ago
|
||
Backed out for causing mochitest failures on test_bug756984.html
Updated•1 years ago
|
Comment 18•1 year ago
|
||
There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:sefeng, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.
Assignee | ||
Comment 19•1 year ago
|
||
I am updating the patch for some additional changes.
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 20•1 year ago
|
||
Comment 21•1 year ago
|
||
Comment 22•1 year ago
|
||
Backed out for causing ThreadSanitizer related failures and failures on test_bug756984.html
Push with failures - 9
Push with failures - 11
Failure log - 9
Failure log - 11
There's also this failure present.
Assignee | ||
Updated•1 year ago
|
Comment 24•1 year ago
|
||
Comment 25•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/f93a68453710
https://hg.mozilla.org/mozilla-central/rev/96e3aa655e92
https://hg.mozilla.org/mozilla-central/rev/bf859c9e86fd
https://hg.mozilla.org/mozilla-central/rev/92ad9c748611
Assignee | ||
Comment 27•1 year ago
|
||
Ryan, do you mind back this patch out from Beta, so that we have more time to fix the regressions? Thanks!
Comment 28•1 year ago
|
||
Backed out for 117.0b9. This change remains in place for 118+. Per discussion with Sean, the fix for bug 1846714 is safe to leave in place even with this backed out, so I didn't include that.
https://hg.mozilla.org/releases/mozilla-beta/rev/f39831155fa1
Description
•