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-env][css-conditional] Need an approach to check whether an environment variable is supported #3576

Open
upsuper opened this issue Jan 31, 2019 · 4 comments

Comments

@upsuper
Copy link
Member

upsuper commented Jan 31, 2019

Websites need to detect whether an environment variable is support in order to have special rules applied on it. It seems there is currently no way to do that.

Natively authors would just use something like

@supports (padding-top: env(safe-area-inset-top)) { ... }

for the detection, but the only thing it checks is that env is supported. If you replace safe-area-inset-top with something else like x, all implementations nowadays would still happily accept it. This is problematic for future extensions.

I'm not sure whether #3285 would solve this (and breaks things like env(x) in @supports). If not, we probably need to either special-case the behavior of env in @supports, or introduce a function for it.

@emilio
Copy link
Collaborator

emilio commented Jan 31, 2019

So I thought that was the purpose for the fallback value in env()? But maybe there's a use-case for detecting a particular environment variable?

Ideally you'd use env(my-var, 10px) or such.

@upsuper
Copy link
Member Author

upsuper commented Jan 31, 2019

Yeah, probably fallback is enough... I need to think more about possible usecases.

@upsuper
Copy link
Member Author

upsuper commented Feb 16, 2019

Okay... I cannot think of any usecase. Authors may want to specify different style when certain env is available, but conceptually I think what they would actually want would be to make the page responsive to different value of the env, which should be done with media queries, and in that case, fallback should be enough.

@fantasai
Copy link
Collaborator

Unlike variables, the set of supported environment variables isn't open-ended, though. Seems legit to ask about support.

@fantasai fantasai added css-conditional-5 Current Work and removed css-conditional-4 labels Dec 25, 2021
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