<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>259261</bug_id>
          
          <creation_ts>2023-07-16 06:18:11 -0700</creation_ts>
          <short_desc>[popover] element within shadow DOM breaks light dismiss calculation</short_desc>
          <delta_ts>2023-10-10 07:04:36 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://github.com/web-platform-tests/wpt/pull/41251</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>148695</blocked>
    
    <blocked>250171</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Westbrook">westbrook.johnson</reporter>
          <assigned_to name="Tim Nguyen (:ntim)">ntim</assigned_to>
          <cc>cdumez</cc>
    
    <cc>ntim</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zsun</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1966965</commentid>
    <comment_count>0</comment_count>
    <who name="Westbrook">westbrook.johnson</who>
    <bug_when>2023-07-16 06:18:11 -0700</bug_when>
    <thetext>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:

&lt;button popovertarget=&quot;popover&quot; popovertargetaction=&quot;toggle&quot;&gt;Toggle&lt;/button&gt;
&lt;div id=&quot;popover&quot; popover&gt;
  &lt;template shadowrootmode=&quot;open&quot;&gt;
    Outter
    &lt;button popovertarget=&quot;popover-2&quot; popovertargetaction=&quot;toggle&quot;&gt;Toggle&lt;/button&gt;
  &lt;div id=&quot;popover-2&quot; popover&gt;
    Inner
  &lt;/div&gt;
  &lt;/template&gt;
&lt;/div&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1966983</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-07-16 15:06:17 -0700</bug_when>
    <thetext>https://searchfox.org/wubkat/rev/3ae98fa2c02b272e3e55c4e0c324d01da17cb5dc/Source/WebCore/dom/Document.cpp#8903

should probably iterate using `parentElementInComposedTree()`.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1967049</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-07-17 10:09:39 -0700</bug_when>
    <thetext>&lt;rdar://problem/112410375&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1968888</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-07-31 11:16:45 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/16234</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1968889</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-07-31 11:20:03 -0700</bug_when>
    <thetext>Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/41251</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1968911</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-07-31 13:05:27 -0700</bug_when>
    <thetext>Committed 266457@main (9336846dfe3b): &lt;https://commits.webkit.org/266457@main&gt;

Reviewed commits have been landed. Closing PR #16234 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1983982</commentid>
    <comment_count>6</comment_count>
    <who name="">zsun</who>
    <bug_when>2023-10-10 07:04:36 -0700</bug_when>
    <thetext>@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&amp;label=experimental&amp;aligned. 

Gecko has the same error report too (with popover enabled). Any idea?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>