Skip to content
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

[css-anchor-position-1] Should custom property declarations be valid in @try? #9198

Closed
cdoublev opened this issue Aug 16, 2023 · 5 comments
Closed

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented Aug 16, 2023

I initially asked this in #9150.

@xiaochengh warned that accepting them would break anchor positioning entirely:

.target {
  position: var(--x);
  --x: absolute;
  position-fallback: --fallbacks;
}

@position-fallback --fallbacks {
  @try { --x: static; }
}

But I wonder if it would work if custom properties are accepted only if there is one or more declarations of the other accepted properties?

@position-fallback --fallbacks {
  @try { --x: static; } /* invalid, ignored */
  @try { --x: static; width: 100px } /* valid */
}

I do not have a strong opinion and I am only interested in disallowing custom properties, because @try is the only rule accepting property declarations that do not accept custom properties.

@xiaochengh
Copy link
Contributor

But I wonder if it would work if custom properties are accepted only if there is one or more declarations of the other accepted properties?

I don't see how this makes a difference. It still allows custom properties to set arbitrary other properties.

@cdoublev
Copy link
Collaborator Author

It still allows custom properties to set arbitrary other properties.

Right, of course, you want fallbacks that can only change the position of the anchored element. You want to know if a fallback would make it overflow its containing block without re-computing styles of all elements.

@cdoublev
Copy link
Collaborator Author

I hope it is ok if I re-open it, because custom properties are implicitly accepted in keyframe rules, so I think either CSS Anchor Position or CSS Animation should explicitly exclude or include them.


From this IRC log:

custom property use in @Try is a good consideration

But this does not seem to have been discussed further. Unless otherwise stated, I am goind to assume this is still not a good consideration.

@cdoublev cdoublev reopened this May 15, 2024
@andruud
Copy link
Member

andruud commented May 15, 2024

The spec excludes them by not including them in the list of things that are accepted. That seems good enough?

@cdoublev
Copy link
Collaborator Author

Yes, my thinking was wrong. Sorry. Definitely closed. 🔒

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants