Bug 259261 - [popover] element within shadow DOM breaks light dismiss calculation
Summary: [popover] element within shadow DOM breaks light dismiss calculation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Nguyen (:ntim)
URL:
Keywords: InRadar
Depends on:
Blocks: 148695 250171
  Show dependency treegraph
 
Reported: 2023-07-16 06:18 PDT by Westbrook
Modified: 2023-10-10 07:04 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Westbrook 2023-07-16 06:18:11 PDT
When a [popover] element that is a descendant of an open [popover] element exists within a shadow DOM, the topmost clicked [popover] element (https://html.spec.whatwg.org/multipage/popover.html#topmost-clicked-popover) calculation is no done with the composed path which causes the descendant [popover] element to close the ancestor [popover] element at open time.

You can repro this here: https://codepen.io/Westbrook/pen/BaGrdoq

With the following code:

<button popovertarget="popover" popovertargetaction="toggle">Toggle</button>
<div id="popover" popover>
  <template shadowrootmode="open">
    Outter
    <button popovertarget="popover-2" popovertargetaction="toggle">Toggle</button>
  <div id="popover-2" popover>
    Inner
  </div>
  </template>
</div>
Comment 1 Tim Nguyen (:ntim) 2023-07-16 15:06:17 PDT
https://searchfox.org/wubkat/rev/3ae98fa2c02b272e3e55c4e0c324d01da17cb5dc/Source/WebCore/dom/Document.cpp#8903

should probably iterate using `parentElementInComposedTree()`.
Comment 2 Radar WebKit Bug Importer 2023-07-17 10:09:39 PDT
<rdar://problem/112410375>
Comment 3 Tim Nguyen (:ntim) 2023-07-31 11:16:45 PDT
Pull request: https://github.com/WebKit/WebKit/pull/16234
Comment 4 Tim Nguyen (:ntim) 2023-07-31 11:20:03 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/41251
Comment 5 EWS 2023-07-31 13:05:27 PDT
Committed 266457@main (9336846dfe3b): <https://commits.webkit.org/266457@main>

Reviewed commits have been landed. Closing PR #16234 and removing active labels.
Comment 6 zsun 2023-10-10 07:04:36 PDT
@ntim

Tim, I noticed the result of the introduced test at https://wpt.fyi/results/html/semantics/popovers/popover-light-dismiss-flat-tree.html?label=master&label=experimental&aligned. 

Gecko has the same error report too (with popover enabled). Any idea?