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

Add footnote about CSS Nesting requiring a symbol to nest element selectors (in some browsers) #6840

Merged
merged 5 commits into from
Sep 27, 2023

Conversation

jensimmons
Copy link
Contributor

Adding a footnote to mark which browsers do not support nesting type selectors without a & (or other mitigation so that the selector starts with a symbol).

Firefox did not ship with this limitation.

Everyone else who supports Nesting has this limitation, except for Safari Technology Preview 179.

Adding a footnote to mark which browsers do not support nesting type selectors without a `&` (or other mitigation so that the selector starts with a symbol). 

Firefox did not ship with this limitation. 

Everyone else who supports Nesting has this limitation, except for Safari Technology Preview 179.
Adjusting footnote. `&` is not required. `:is()` could be used instead. Anything that makes the selector start with a symbol.
@jensimmons jensimmons changed the title Update css-nesting.json Add footnote about CSS Nesting requiring a symbol to nest element selectors (in some browsers) Sep 25, 2023
@jensimmons
Copy link
Contributor Author

While marking Chromium and WebKit browsers as requiring a symbol to nest element selectors, I left those browsers as having full support (bright green box).

They do not have incomplete support. They still support all of Nesting. They just have this one requirement regarding a detail in the syntax. A requirement that was in the CSS specification, but has since been relaxed.

@Serator
Copy link

Serator commented Sep 26, 2023

https://bugs.chromium.org/p/chromium/issues/detail?id=1427259 - Chrome (Chromium based) bug for this issue.
If Chrome is the only browser that doesn't even ship this feature in the alpha version yet, it would probably be appropriate to add this to the notes. Thanks!

Adding link to Chromium issue to footnote.
@jensimmons
Copy link
Contributor Author

Good idea. Thanks. Done.

Putting the `&` in code.
@jensimmons
Copy link
Contributor Author

I’d love it if this PR could be accepted by Thursday morning. :D

Firefox on Android should not have any notes. Mistake corrected.
@Fyrd Fyrd merged commit 43a42c1 into Fyrd:main Sep 27, 2023
1 check passed
@Fyrd
Copy link
Owner

Fyrd commented Sep 27, 2023

Thanks!

@romainmenke
Copy link

The older versions really should be marked as partial implementations.
They literally do not support the entire feature.

It is critical for users of caniuse that the data is correct.
What the specification was at a given point in time when browsers initially shipped something is irrelevant.

@brandonmcconnell
Copy link

brandonmcconnell commented Sep 28, 2023

If I understand correctly, the latest accepted implementation of this feature does not require starting with a symbol but can include a symbol anywhere. If the selector is invalid, it is then checked for a symbol.

Related— the latest comments here: w3c/csswg-drafts#8253

Is that different from what is being described here in this issue (#6840)

Are there any browsers that do not implement nesting using this behavior?

cc @tabatkins @Loirooriol

@romainmenke
Copy link

romainmenke commented Sep 28, 2023

Maybe best not to start a longer conversation in a merged pull request :)

My comment was specifically to address that adding notes about partial implementations without assigning the correct status flag is a bad pattern.

@jensimmons
Copy link
Contributor Author

jensimmons commented Sep 28, 2023

I believe marking bright green with a footnote is the correct level of information.

This is not AreTheBrowserEngineersDone.com or DoesThisMatchTheStandard.com. It's CanIUse.com.

What matters is the experience of the web developer. Can they use CSS Nesting? Yes. Well, if you set aside percentage of users on which version of which browser...

If development team is building a site, and somehow magically they know 100% of their users are on Chrome 117 or Safari 17.0 — can they feel confident about using CSS Nesting? Is it solid? Trustworthy? Will it work? Yes, yes, and yes.

They do need to know about the requirement to start with a symbol when nesting an element selector. That's very important, and worthy of a prominent note. But as long as they stick to that, they are fine. Nesting is ready to be used.

Partial support conveys "hey, maybe don't use this. It's only half built. You might be able to get away with it, but there's a good chance your code will fail. Or something unstable might happen in the future. Be wary. Hold off." And I do not believe that is the correct message to send about Nesting.

Can you use CSS Nesting? Absolutely. (Once all the Chromium mobile browsers have caught up, and enough of your users have updated.) Go for it. Green boxes all the way down. This is solid and ready.

@jensimmons jensimmons deleted the patch-42 branch September 28, 2023 22:25
@romainmenke
Copy link

romainmenke commented Sep 28, 2023

They do need to know about the requirement to start with a symbol when nesting an element selector. That's very important, and worthy of a prominent note. But as long as they stick to that, they are fine. Nesting is ready to be used.

That is the definition of "partial support" @jensimmons 😕
A feature that can be used as long as you know which parts are safe to use.

That is problematic.
We need accurate data of when a feature was fully supported.

It should really be better defined what full and partial support mean. @Fyrd?

@romainmenke
Copy link

romainmenke commented Sep 28, 2023

Can it be added as a separate feature or a sub feature?

Then nesting can be what initially shipped and can remain "full supported".

That would give us green boxes now and accurate (machine readable) data.

Also important to keep in mind that the partial support status is temporary.

@brandonmcconnell
Copy link

@romainmenke @jensimmons Agreed. I was speaking to the support for div& which would work identically to &:is(div). Perhaps that's best suited for an interop issue for Interop 2024.

See related notes here: w3c/csswg-drafts#8253


That said, it may help to include a note/point for that capability (div&) in caniuse as well.

@Fyrd
Copy link
Owner

Fyrd commented Sep 29, 2023

Yeah determining when support is partial is tricky. Originally I was more liberal in applying the "supported" label as long as the main purpose was fulfilled. By that logic this would certainly qualify as supported.

However over time developers have generally expressed a preference for "supported" meaning they can just use it without any concern at all, and "partial" whenever that's not the case. Admittedly it's much easier to see a bunch of green boxes and in this case assume the latest syntax can safely be used without reading the fine print.

The partial indicator is much harder to miss and (hopefully) does a better job encouraging people to learn about the reasoning then use their own judgment on whether or not the feature can be used. I haven't personally heard of anyone that's avoided using a feature outright due to "partial" support so I don't think that would scare anyone away.

I still don't think "supported" means the feature needs to be 100% supported as uncommon edge cases may be a reason for a note instead of partial support. But I don't think that's the case here, so I support using "partial" when a symbol is required for nested features.

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

Successfully merging this pull request may close these issues.

5 participants