Closed Bug 1792110 Opened 2 years ago Closed 1 year ago

Difference between Firefox and Chrome event propagation when using pointer-events: none on :active pseudo selector

Categories

(Core :: DOM: Events, defect)

All
Unspecified
defect

Tracking

()

RESOLVED FIXED
117 Branch
Webcompat Priority P2
Tracking Status
firefox117 --- wontfix
firefox118 --- fixed

People

(Reporter: ksenia, Assigned: sefeng)

References

()

Details

Attachments

(5 files)

Attached file 108202.html (deleted) —

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?

Edgar, do you have thoughts about the expected behavior here?

Also wondering - is this is something in interop investigation list?

Flags: needinfo?(echen)

(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.

(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?).

Flags: needinfo?(echen) → needinfo?(smaug)
Webcompat Priority: --- → ?

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.

Flags: needinfo?(smaug)

(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?

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.

Severity: -- → S3
Flags: needinfo?(sefeng)
Webcompat Priority: ? → P2

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.

Assignee: nobody → sefeng
Status: NEW → ASSIGNED
Attachment #9335505 - Attachment description: Bug 1792110 - Make pointer events still bubble up to ancestors when using pointer-events: none r=edgar → Bug 1792110 - Update the common ancestor finding logic for mouseup with mousedown r=edgar
Attachment #9337269 - Attachment description: Bug 1792110 - Updathe two PIP tests to align with the latest change for dispatching click events r=edgar,niklas → Bug 1792110 - Updathe PIP tests to align with the latest change for dispatching click events r=edgar,niklas
Pushed by sefeng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/37614918cfa8 Update the common ancestor finding logic for mouseup with mousedown r=edgar https://hg.mozilla.org/integration/autoland/rev/db71444cb84f Updathe PIP tests to align with the latest change for dispatching click events r=edgar,niklas
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/40460 for changes under testing/web-platform/tests

Please also check :

Upstream PR was closed without merging
Pushed by sefeng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/63bffcdc61e8 Update the common ancestor finding logic for mouseup with mousedown r=edgar https://hg.mozilla.org/integration/autoland/rev/083b3dc773f3 Updathe PIP tests to align with the latest change for dispatching click events r=edgar,niklas https://hg.mozilla.org/integration/autoland/rev/0d88c6fe314b Update test_Bug 1792110.html to accommodate the common ancestor changes for mouseup r=edgar

Backed out for causing mochitest failures on test_bug756984.html

Backout link

Push with failures

Failure log

Upstream PR was closed without merging
Attachment #9338163 - Attachment description: Update test_Bug 1792110.html to accommodate the common ancestor changes for mouseup r=edgar → Bug 1792110 - Update test_Bug 1792110.html to accommodate the common ancestor changes for mouseup r=edgar

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.

Flags: needinfo?(sefeng)
Flags: needinfo?(echen)

I am updating the patch for some additional changes.

Flags: needinfo?(sefeng)
Flags: needinfo?(echen)
Pushed by sefeng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d492bd7d93d7 Update the common ancestor finding logic for mouseup with mousedown r=edgar https://hg.mozilla.org/integration/autoland/rev/9cfe7f3b3e3e Updathe PIP tests to align with the latest change for dispatching click events r=edgar,niklas https://hg.mozilla.org/integration/autoland/rev/c29961741ee1 Update test_Bug 1792110.html to accommodate the common ancestor changes for mouseup r=edgar https://hg.mozilla.org/integration/autoland/rev/510ddee05cfc Make no common ancestor between mouseup and mousedown when the input control type is different r=edgar https://hg.mozilla.org/integration/autoland/rev/66ee3cdf67e0 apply code formatting via Lando

Backed out for causing ThreadSanitizer related failures and failures on test_bug756984.html

Backout link

Push with failures - 9
Push with failures - 11

Failure log - 9
Failure log - 11

There's also this failure present.

Flags: needinfo?(sefeng)
Upstream PR was closed without merging
Flags: needinfo?(sefeng)
Pushed by sefeng@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f93a68453710 Update the common ancestor finding logic for mouseup with mousedown r=edgar https://hg.mozilla.org/integration/autoland/rev/96e3aa655e92 Updathe PIP tests to align with the latest change for dispatching click events r=edgar,niklas https://hg.mozilla.org/integration/autoland/rev/bf859c9e86fd Update test_Bug 1792110.html to accommodate the common ancestor changes for mouseup r=edgar https://hg.mozilla.org/integration/autoland/rev/92ad9c748611 Make no common ancestor between mouseup and mousedown when the input control type is different r=edgar
Upstream PR merged by moz-wptsync-bot
Regressions: 1846714
Regressions: 1846754
Regressions: 1847067
Regressions: 1848540
Regressions: 1847889

Ryan, do you mind back this patch out from Beta, so that we have more time to fix the regressions? Thanks!

Flags: needinfo?(ryanvm)

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

Flags: needinfo?(ryanvm)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: