Popover position improvement idea #29868
Labels
[Feature] Component System
WordPress component system
[Type] Discussion
For issues that are high-level and not yet ready to implement.
Alternative to the idea proposed in #21275.
The popover position API is very clunky and it tries to satisfy a lot of different positioning needs.
What if we provide a base rectangle and allow popovers to be positioned from there, purely in CSS? Why reinvent the wheel and maintain or introduce a positioning API if CSS provides a great one?
How could this be done?
Instead of positioning a popover immediately at the target position, we position the wrapper popover div element exactly over the anchor element so that it has the same dimensions and positions (base rectangle).
^= Imagine a the popover div overlays the anchor div.
From there, the popover content div can take any relative position it wants through the CSS positioning API. You can even stretch it as an overlay (imagine a block overlay through a popover).
That's pretty much it. :)
Of course we can map the existing position API with CSS, and we can provide better JS shortcuts if we want. The point is for it to be powered by CSS under the hood and allow all the flexibility of CSS.
Cc @youknowriad.
The text was updated successfully, but these errors were encountered: