-
-
Notifications
You must be signed in to change notification settings - Fork 15
Allow anchor-size on margin and inset properties #309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for anchor-polyfill ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for anchor-position-wpt canceled.
|
jgerigmeyer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well!
I alternatively could define a subset of the @position-try declarations that actually accept lengths.
My reading of the spec is actually that anchor-size only accepts a subset of the valid @position-try declarations that do accept lengths:
It’s being used in a sizing property, an inset property, or a margin property on an absolutely positioned box. (These are the accepted @position-try properties that allow lengths.)
So I'd recommend we split ACCEPTED_POSITION_TRY_PROPERTIES from ACCEPTED_ANCHOR_SIZE_PROPERTIES.
| @@ -0,0 +1,12 @@ | |||
| #my-anchor-anchor-size-extended { | |||
| anchor-name: --my-anchor-size-extended; | |||
| resize: both; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fun! I approve 🤓
Description
https://drafts.csswg.org/css-anchor-position-1/#anchor-size-fn
Spec changed in w3c/csswg-drafts#9827 to allow
anchor-sizeon all properties that are allowed in@position-tryblocks. This includes some nonsensical ones likealign-self, which don't take lengths. I went with the "technically correct" tact of allowing anchor size to be used on those, but I alternatively could define a subset of the@position-trydeclarations that actually accept lengths.Related Issue(s)
Fixes #288
Steps to test/reproduce
https://deploy-preview-309--anchor-polyfill.netlify.app/#anchor-size-extended