Skip to content

feat(w3c/style): let an editor turn dark mode off with darkMode: false - #5437

Open
marcoscaceres wants to merge 2 commits into
mainfrom
feat/dark-mode-opt-out
Open

feat(w3c/style): let an editor turn dark mode off with darkMode: false#5437
marcoscaceres wants to merge 2 commits into
mainfrom
feat/dark-mode-opt-out

Conversation

@marcoscaceres

Copy link
Copy Markdown
Contributor

An editor can now set darkMode: false and 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's Dark Mode metadata, including that second half. Only an explicit false disables 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: false the published bytes carry no dark.css link, no preload hint for it, no color-scheme meta, and none of ReSpec's five dark media queries; with the option absent, all five remain and the link is present with disabled="". Marcos then confirmed it manually, including with the operating system set to dark, which is the case the strip exists for.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread src/w3c/style.js Outdated

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

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 copilot-code-review.yml file. Read the docs for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 6 comments.

Comment thread tests/spec/w3c/dark-mode-opt-out-spec.js Outdated
Comment thread tests/spec/w3c/dark-mode-opt-out-spec.js Outdated
Comment thread tests/spec/w3c/dark-mode-opt-out-spec.js Outdated
Comment thread tests/spec/w3c/dark-mode-opt-out-spec.js Outdated
Comment thread tests/spec/w3c/dark-mode-opt-out-spec.js Outdated
Comment thread tests/spec/w3c/dark-mode-opt-out-spec.js Outdated
@marcoscaceres
marcoscaceres force-pushed the feat/dark-mode-opt-out branch 2 times, most recently from 751849d to 7c7b51b Compare September 1, 2026 07:18
@marcoscaceres
marcoscaceres changed the base branch from fix/dark-css-last to refactor/core-insert-style September 1, 2026 07:36
@marcoscaceres marcoscaceres added the AI Contains AI-generated logic; see AI_POLICY.md label Sep 2, 2026
@marcoscaceres
marcoscaceres force-pushed the refactor/core-insert-style branch from 6d2ac24 to 1146b90 Compare September 2, 2026 11:30
@marcoscaceres
marcoscaceres changed the base branch from refactor/core-insert-style to fix/dark-css-last September 2, 2026 12:54
@marcoscaceres
marcoscaceres force-pushed the feat/dark-mode-opt-out branch 2 times, most recently from 6ea3ca8 to 527b4cf Compare September 2, 2026 13:51
Base automatically changed from fix/dark-css-last to main September 2, 2026 13:58
marcoscaceres and others added 2 commits September 5, 2026 14:51
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Contains AI-generated logic; see AI_POLICY.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants