feat(w3c/style): let an editor turn dark mode off with darkMode: false - #5437
feat(w3c/style): let an editor turn dark mode off with darkMode: false#5437marcoscaceres wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a W3C darkMode: false opt-out that removes ReSpec-provided dark-mode resources and styles.
Changes:
- Adds strict opt-out handling and dark-media-query stripping.
- Documents the transitional configuration option.
- Adds integration coverage and an author-style fixture.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/w3c/style.js |
Implements dark-mode opt-out behavior. |
src/type-helper.d.ts |
Types and documents darkMode. |
tests/spec/w3c/dark-mode-opt-out-spec.js |
Tests opt-out behavior and preservation. |
tests/spec/core/author-dark-style.html |
Provides author CSS fixture. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
One or more custom setup steps configured for this repository failed during this Copilot code review run: Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review. Note You can configure setup steps for Copilot code review separately from Copilot cloud agent with a |
751849d to
7c7b51b
Compare
6d2ac24 to
1146b90
Compare
7c7b51b to
4c46391
Compare
3cf22c2 to
6c2dca8
Compare
6ea3ca8 to
527b4cf
Compare
527b4cf to
53bf584
Compare
Matches Bikeshed's `Dark Mode` metadata: ReSpec emits no dark stylesheet so fixup.js builds no theme toggle, and ReSpec strips its own dark styles so a reader whose OS prefers dark does not get a light page with dark components in it. Co-Authored-By: Claude <noreply@anthropic.com>
53bf584 to
01199a7
Compare
An editor can now set
darkMode: falseand ReSpec stops offering dark mode for that spec: it emits no dark stylesheet, so W3C's fixup.js finds nothing to toggle, and it strips its own@media (prefers-color-scheme: dark)blocks so a reader whose operating system prefers dark does not land on a light page with dark ReSpec components in it. This matches Bikeshed'sDark Modemetadata, including that second half. Only an explicitfalsedisables anything.The option is transitional and the documentation says so: custom CSS that is not dark-aware is the thing to fix.
Stacked on #5436, so the base is that branch and the diff shows only this change. No release should go out before the stylesheet work lands.
Gemini wrote the tests from the specification before this implementation existed. I edited two things in them, both noted in the file: a matcher that could never fail against the minified bundle, and an unused import that failed lint.
Written with AI: this change was generated by Claude. Per AI_POLICY.md.
Proof: exporting the same source with each configuration. With
darkMode: falsethe published bytes carry nodark.csslink, no preload hint for it, nocolor-schememeta, and none of ReSpec's five dark media queries; with the option absent, all five remain and the link is present withdisabled="". Marcos then confirmed it manually, including with the operating system set to dark, which is the case the strip exists for.