Closed Bug 1598476 Opened 5 years ago Closed 4 years ago

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

Categories

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

task

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

yu han <yuzhehan@chromium.org> wrote:

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 click event.

DOMActivate event is depreciated:
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/1928234
WPT-Export-Revision: e7301c0f0271cfac01c43642d68ce0d06ae52f09

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]

GitHub CI Results

wpt.fyi PR Results Base Results

Ran 1 tests and 5 subtests

Firefox

OK : 1
PASS: 5

Chrome

TIMEOUT: 1
NOTRUN : 2

Safari

PASS : 1
TIMEOUT: 1
NOTRUN : 2

Gecko CI Results

Ran 1 tests and 5 subtests
OK : 1
PASS : 5

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