From fa8e9c41c5581439f93897e7c2fe674f803bfa21 Mon Sep 17 00:00:00 2001 From: yu han Date: Mon, 25 Nov 2019 00:40:37 -0800 Subject: [PATCH] Fixes click on inline element embedded in anchor inside breaks anchor. Previous to this CL, clicking on an inline element embedded in an anchor placed inside a tag will expand the
section instead of navigating to the anchor's href. However, when the anchor is placed outside of , 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 , 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 Reviewed-by: Mason Freed Commit-Queue: Yu Han Cr-Commit-Position: refs/heads/master@{#718552} --- .../anchor-with-inline-element.html | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 html/semantics/interactive-elements/the-summary-element/anchor-with-inline-element.html diff --git a/html/semantics/interactive-elements/the-summary-element/anchor-with-inline-element.html b/html/semantics/interactive-elements/the-summary-element/anchor-with-inline-element.html new file mode 100644 index 00000000000000..ab200020b4f053 --- /dev/null +++ b/html/semantics/interactive-elements/the-summary-element/anchor-with-inline-element.html @@ -0,0 +1,77 @@ + + +summary element: clicking on anchor containing inline element + + + + + + +
+ Anchor text is wrapped with <i> tag permalink +

asdf

+
+ +
+ This one uses <span>. permalink +

asdf

+
+ +
+ + + + + + + + <circle> + + + + +

asdf

+
+ + \ No newline at end of file