This issue is closely related to https://bugs.webkit.org/show_bug.cgi?id=259261 in that I would have expected the flattened tree calculation added there to have prevented this, but here again, we see the light dismiss calculation for a `[popover="auto"]` element going awry. As seen in https://codepen.io/Westbrook/pen/JjwVYmr Safari 17 and TP both overreach and close the root popover erroneously when opening the child popover. Steps: 1) Visit https://codepen.io/Westbrook/pen/JjwVYmr 2) Click the "Show" button. 3) See the "outer" [popover] element open at the center of the page. 4) Click the "Show" button within the initial [popover] element. 5) See the "outer" [popover] element closed due to the light dismiss calculation, preventing the "inner" [popover] element from becoming visible. If you run the same steps in Chrome, you'll see the "inner" [popover] open over the "outer" [popover] as expected.
Firefox Nightly Not working (after setting dom.element.popover.enabled to true in about:config) In Safari the second nested showPopover() fails silently. In chrome we can see it.
It seems that the DSD flag was maybe removed from Firefox nightly, but that feature was only leveraged for simplicity, it wasn't part of the larger issue. This demo exemplifies the issue with imperative Shadow DOM: https://codepen.io/Westbrook/pen/jOXooPB?editors=1010
<rdar://problem/117214343>
Here's another place that needs to use the flat tree: https://searchfox.org/wubkat/rev/c64f97a4afc2aa3f73f74f59630410234ca8a659/Source/WebCore/html/HTMLElement.cpp#1286
I'm happy to take a look at this. I've got a WPT that covers it so shouldn't take long.
Pull request: https://github.com/WebKit/WebKit/pull/19314
Committed 269596@main (4ab4d8351529): <https://commits.webkit.org/269596@main> Reviewed commits have been landed. Closing PR #19314 and removing active labels.