Closed Bug 1612214 Opened 5 years ago Closed 5 years ago

[wpt-sync] Sync PR 21500 - Reland "Fixes click on inline element embedded in anchor inside <summary> breaks anchor."

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 21500 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/21500
Details from upstream follow.

Yu Han <yuzhehan@chromium.org> wrote:

Reland "Fixes click on inline element embedded in anchor inside <summary> breaks anchor."

This reverts commit b4cb14f3cacece63ea28e9a021a77c41867e0503.

Reason for revert: Getting ready to reland

Original change's description:

Revert "Fixes click on inline element embedded in anchor inside \<summary> breaks anchor."

This reverts commit 4eb4df63f17ee0f22cd17472fa6ae92311e49900.

Reason for revert: Caused crbug.com/1045433.

Original change's description:

Fixes click on inline element embedded in anchor inside \<summary> breaks anchor.

Previous to this CL, clicking on an inline element embedded in an anchor placed
inside a \<summary> tag will expand the \<details> section instead of navigating to
the anchor's href. However, when the anchor is placed outside of \<summary>,
it behaves correctly.

The error is caused by DOMActivate event generated by the inline element. As
DOMActivate bubbles up, it bypasses the anchor's event handler, reaches the
\<summary>, and is handled there. Once DOMActivate is handled, the original
click event stops propagating and terminates. This behavior, however, differs
from when the anchor tag is placed outside of the summary. DOMActivate isn't
handled, and the original click event keeps bubbling up till it's handled by
the anchor.

DOMActivate event is deprecated:
https://developer.mozilla.org/en-US/docs/Web/API/Element/DOMActivate_event.
However, since blink still has code that depends on it, replacing it is outside
of the scope for this fix. Instead, this fix is for the anchor element to
handle the DOMActivate event as it bubbles up. The anchor event handler checks
the underlying event of DOMActivate and handles it if it's a click.

I also looked at an alternative fix by trying to prevent the DOMActivate event
from bubbling up. But calling event.stopPropagation() doesn't work as the
EventDispatcher::DispatchEventPostProcess doesn't check this status.

Bug: 538283
Change-Id: I11fb072faa0563279d43a28e5dc19cee89906bf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1928234
Reviewed-by: Kent Tamura \<tkent@chromium.org>
Reviewed-by: Mason Freed \<masonfreed@chromium.org>
Commit-Queue: Yu Han \<yuzhehan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718552}

TBR=tkent@chromium.org,masonfreed@chromium.org,yuzhehan@chromium.org

Bug: 1045433
Change-Id: I14b369beb04171ef846cb3a79ebb3fe268cf5c89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023267
Reviewed-by: Mason Freed \<masonfreed@chromium.org>
Commit-Queue: Yu Han \<yuzhehan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735575}

TBR=tkent@chromium.org,masonfreed@chromium.org,yuzhehan@chromium.org

Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1045433
Change-Id: I0cdd7b48a2c4e9bf2b653edef9ce7970d7e64938

Reviewed-on: https://chromium-review.googlesource.com/2028455
WPT-Export-Revision: 6118b5e2dd8613e70721c583373d8a1f4fa9f088

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 2 tests and 1 subtests

Status Summary

Firefox

OK : 2
PASS : 6

Chrome

OK : 1
PASS : 1
TIMEOUT: 1
NOTRUN : 2

Safari

OK : 1
PASS : 2
TIMEOUT: 1
NOTRUN : 2

Links

GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/234d1421a9de [wpt PR 21500] - Reland "Fixes click on inline element embedded in anchor inside <summary> breaks anchor.", a=testonly
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
You need to log in before you can comment on or make changes to this bug.