Add inset: auto to a polyfilled popover#410
Conversation
✅ Deploy Preview for anchor-position-wpt canceled.
|
✅ Deploy Preview for anchor-polyfill ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
jamesnw
left a comment
There was a problem hiding this comment.
Thanks for taking this on! I think this has 2 issues-
- You've applied it to position-area uses, not popover. Not all popovers use position-area, and not all position-area uses are popover.
- This overwrites existing insets on the element, but they need to be maintained.
Maybe the algorithm is "if the positioned element has the popover attribute, get the computed value of each inset. If it is 0, set to auto". (I'm less certain of tthe second step)
Does it make sense to have both I've added an if around setting |
Yeah, it is a legitimate use case- setting an inset allows you to position the content within the containing block generated by
This still misses the case where it is a popover not using position-area. For instance, the demo above the one you added is setting margin:0 to accomplish the same thing. If inset: auto is applied to that, the margin can be removed. |
I'll work on this; thanks.
I think you're wrong here :) When i remove |
I've got it working! It checkes if the target is a popover and has a non-zero |
jamesnw
left a comment
There was a problem hiding this comment.
This is close! Just a few small changes.
Co-authored-by: James Stuckey Weber <james@oddbird.net>
Co-authored-by: James Stuckey Weber <james@oddbird.net>
jamesnw
left a comment
There was a problem hiding this comment.
This looks good! Thanks for your work on this!
Closes #330
Fixes positioning of polyfilled popovers that use
position-areaby explicitly settinginset: autoon the target element inside the wrapper. Without this, the browser's defaultinsetvalues on[popover]elements conflict with the wrapper-based positioning approach.Also adds a demo example to
index.htmlshowing a popover anchored viaposition-areainstead ofanchor().