fix(w3c/style): always add the dark stylesheet link so the theme toggle appears - #5408
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the W3C styling pipeline so a dark.css stylesheet link is always present, ensuring W3C’s fixup.js injects the light/dark/auto theme toggle even for “light-only” specs (closing #5200).
Changes:
- Always add the W3C
dark.cssstylesheet link; keep it disabled when the spec hasn’t opted into dark mode viameta[name="color-scheme"]. - Add a regression test asserting that a
rel="stylesheet"dark stylesheet link exists for light-only specs (without assertingdisabledto avoid network dependence).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/w3c/style.js |
Always injects a dark stylesheet link (disabled for light-only specs) so W3C fixup can render the theme toggle. |
tests/spec/w3c/style-spec.js |
Adds a test to ensure light-only specs still get a dark stylesheet link[rel="stylesheet"] so the toggle can appear. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
marcoscaceres
force-pushed
the
fix/5200-firefox-theme-toggle
branch
from
August 19, 2026 07:09
e179656 to
a711868
Compare
Contributor
Author
marcoscaceres
force-pushed
the
fix/5200-firefox-theme-toggle
branch
from
August 19, 2026 07:24
a711868 to
7c64e2c
Compare
marcoscaceres
marked this pull request as ready for review
August 19, 2026 07:27
Contributor
Author
|
Approving. Reviewed locally fully together with Claude and had copilot check it. |
This was referenced Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #5200
W3C's
fixup.jsonly injects the light/dark/auto theme toggle when it finds a dark stylesheet link, since it drives that link'sdisabledproperty. Light-only specs never got the link, so the whole block was skipped and no toggle appeared. The link is now always added, disabled when the spec has not opted into dark mode.Intended consequence worth calling out: a light-only spec now gets a working toggle, so a reader can switch it to dark and the dark stylesheet will apply, on a document that never declared
color-scheme. That is deliberate. Readers get the same control they have on every other TR document, and spec authors should not be deciding this on their behalf.Two implementation notes for review. The link is disabled after insertion rather than before, because per HTML the
disabledsetter is a no-op while the link's style sheet is still null. And the test asserts only that the link exists, not that it is disabled, sincedisableddepends on the sheet loading from www.w3.org and would make the test network-dependent; therel="stylesheet"filter in the selector matters, because a preload hint for the same href is also present.Verified in Firefox 153, the browser in the bug report: without the fix the sidebar has no dark stylesheet link, no toggle and no radio inputs; with it, the toggle and all three options appear.
Written with AI: this change was generated by Claude. Per AI_POLICY.md.