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

Question on when we should consider :is() browser support to be at 98% #2522

Open
mkrause opened this issue Feb 23, 2025 · 1 comment
Open
Labels

Comments

@mkrause
Copy link

mkrause commented Feb 23, 2025

As per the blog post on native CSS nesting, Sass would consider emitting nesting rules using :is() when browser support for this feature is at least 98%. It links to the caniuse page as a reference for this statement, which is currently listing 95.91% of global marketshare with full support for :is().

However, as per the discussion here, any percentage reported by caniuse is capped at 97.98% due to the way it considers untracked browsers to (pessimistically) always have 0% support. This means that :is() will never reach 98% as per the default metric. If we change to "all tracked" instead, then caniuse reports 98+% support for :is().

So then, should we consider :is() to be at the required level of support now?

@nex3
Copy link
Contributor

nex3 commented Feb 24, 2025

This is a tricky question. We really do want to be very conservative about when we unavoidably emit code that's known to be incompatible with older browsers: in almost all cases, Sass will only emit new CSS features if the author explicitly writes them, so our browser compatibility window is very long by default, and we don't want to break users who are relying on that (e.g. to support internal tools, to support markets with high retention of older devices, etc). On the other hand, there's no point in having a bar that's literally impossible to reach.

I think the most robust solution here would be to say that in order to demonstrate that it's sufficiently safe to use a given feature, someone needs to actually do the legwork and test that feature against enough of the remaining browsers not covered by caniuse to show that it does in practice have 98%+ penetration. Unfortunately, the caniuse data doesn't make it very clear what those browsers are or what the relative usage percentages of each version is, so this is substantially difficult in its own right. But I do think it's worth investigating.

It's also worth noting that although the "all tracked" support for :is() is 98.09%, the "tracked desktop" support is only 96.47%, which possibly should be enough to disqualify it on its own.

From a broader perspective: :is() isn't even 5 years old yet in its current form. We only started emitting hsl() in 2022, twenty years after it first appeared in a working draft for CSS Color 3 and 14 years after full support first landed in Firefox. This situation is definitely a little different, in that moving to :is() aligns us with CSS compatibility in other ways, but I'm still in no hurry to start supporting it.

@nex3 nex3 added the question label Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants