Skip to content

update docs to reflect new css custom state syntax - #31258

Merged
hamishwillee merged 16 commits into
mdn:mainfrom
keithamus:update-docs-to-reflect-new-css-custom-state-syntax
Feb 4, 2024
Merged

hamishwillee merged 16 commits into
mdn:mainfrom
keithamus:update-docs-to-reflect-new-css-custom-state-syntax

Conversation

@keithamus

Copy link
Copy Markdown
Contributor

Description

It has been agreed that the new syntax for CSS custom states will be :state(foo) rather than :--foo. Chrome has shipped :--foo for a little while now but both Firefox and WebKit implementations support the :state(foo) syntax and Chrome will soon be updated to support both (with some pathway to deprecating the :--foo syntax). Consequently this is an attempt to update the documentation to reflect this, by presenting the core content as using the :state(foo) syntax whilst mentioning that :--foo is the legacy syntax.

Motivation

Both Firefox and WebKit support the new syntax behind a flag and may start shipping this syntax. The HTML spec has a PR (whatwg/html#8467) that defines the new :state(foo) syntax. Chrome will likely update to support both soon.

Currently this support creates a discrepancy between the support the browsers have, intend to have, and what the documentation outlines. The motivation here is to point folks toward the new syntax while also pointing out the legacy issues.

Additional details

whatwg/html#8467
https://bugs.webkit.org/show_bug.cgi?id=266845
https://bugzilla.mozilla.org/show_bug.cgi?id=1861466

Related issues and pull requests

@github-actions github-actions Bot added the Content:WebAPI Web API docs label Dec 23, 2023
@github-actions

github-actions Bot commented Dec 23, 2023 •

Copy link
Copy Markdown
Contributor

Preview URLs

Flaws (2)

Note! 1 document with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/API/CustomStateSet
Title: CustomStateSet
Flaw count: 1

  • broken_links:
    • Can't resolve /en-US/docs/Web/CSS/:state

URL: /en-US/docs/Web/API/CustomStateSet/add
Title: CustomStateSet: add() method
Flaw count: 1

  • broken_links:
    • Can't resolve /en-US/docs/Web/CSS/:state

(comment last updated: 2024-02-04 23:11:59)

@keithamus
keithamus force-pushed the update-docs-to-reflect-new-css-custom-state-syntax branch from 6c04b23 to db66418 Compare December 23, 2023 14:51
@keithamus
keithamus marked this pull request as ready for review December 23, 2023 15:01
@keithamus
keithamus requested review from a team and wbamberg and removed request for a team December 23, 2023 15:01
@annevk annevk mentioned this pull request Dec 24, 2023
4 tasks done
@wbamberg

Copy link
Copy Markdown
Collaborator

@estelle , would you mind looking at this PR? I think you'd be a better fit for it than me.

@hamishwillee

Copy link
Copy Markdown
Collaborator

@wbamberg Lots of churn on this. I did the changes this updates about a month ago so I can review this.

@hamishwillee
hamishwillee self-requested a review January 29, 2024 00:07
@github-actions github-actions Bot added the size/xl [PR only] >1000 LoC changed label Jan 29, 2024
@hamishwillee

Copy link
Copy Markdown
Collaborator

@keithamus Thanks for this change - nicely done. Is there a chromium bug I can use to track when state() is supported in a live version of Chrome?

I've made some modifications and a few comments. The modifications are intended to make it easier to:

  • better cross-link to state() which will be defined soon.
  • find out when the CSS pseudo class is supported - by checking the state(),
  • clean this document up in future as the "legacy" implementation becomes irrelevant.

I think state() still needs to be documented for this to all hang together. Will look at that too. Or at least the compatibilty data part.

This is close to merging, but I'd like you to check my changes and see comments first.

@keithamus

Copy link
Copy Markdown
Contributor Author

@hamishwillee

Is there a chromium bug I can use to track when state() is supported in a live version of Chrome?

Here's the chromium i2s: https://groups.google.com/a/chromium.org/g/blink-dev/c/GDmNaxAuCY4, tracking bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1514397, CL: https://chromium-review.googlesource.com/c/chromium/src/+/5153145. It's yet to be merged so there's no version to test it, as of yet.

This is close to merging, but I'd like you to check my changes and see comments first.

Gave it one more read through, tidying up small parts, but IMO this is good to go now.

@wbamberg
wbamberg removed their request for review January 29, 2024 19:24
@github-actions github-actions Bot added size/m [PR only] 51-500 LoC changed and removed size/xl [PR only] >1000 LoC changed labels Feb 4, 2024

@hamishwillee hamishwillee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @keithamus - this is good. We might improve it by looking at #31258 (comment) (would appreciate your comment) but merging now.

@hamishwillee
hamishwillee merged commit c6e8c32 into mdn:main Feb 4, 2024
@keithamus
keithamus deleted the update-docs-to-reflect-new-css-custom-state-syntax branch February 5, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants