Track top layer order
As of #90, the polyfill supports anchoring of top layer elements but we want to also keep track of the order of top layer elements to ensure a top layer target element cannot anchor to a succeeding top layer anchor, like this WPT shows.
Some additional context and background:
- While some browsers are beginning to roll out a way to inspect the top layer, as of now there is no programmatic way to access the order of the elements in the top layer so we need to track and maintain this within the polyfill. There is an open request for an API here.
- To keep track of this order, we need to listen for events like
showPopover,showDialog,close(), and clicks to dismiss popovers as well. - As the order of the top layer elements change, we will need to revalidate to prevent cases like WPT anchor-position-top-layer-006. This is related to the feature requested in #91 because dynamically adding and removing anchors and/or targets are not yet supported.
@jgerigmeyer This appears to be related to #103 - is it a duplicate, or does it need to be tracked separately?
@jamesnw I think this might be irrelevant given the changes in #103? I'm not entirely sure without digging into the updated WPTs.
Makes sense- let's keep it open, and revisit once we get to the potentially related task.