Skip to content

Honor theme="light" over system dark mode - #3126

Open
SybelBlue wants to merge 2 commits into
arnog:masterfrom
SybelBlue:SybelBlue/fix-light-theme-override
Open

SybelBlue wants to merge 2 commits into
arnog:masterfrom
SybelBlue:SybelBlue/fix-light-theme-override

Conversation

@SybelBlue

@SybelBlue SybelBlue commented Oct 20, 2026 •

Copy link
Copy Markdown

Summary

This issue is affecting PrairieLearn downstream! We'd appreciate a swift resolution so we can revert our workaround.

This fix:

  • makes theme="light" override prefers-color-scheme: dark for mathfield, shared UI, and menu colors
  • preserves theme="dark" behavior on light systems
  • keeps the theme selectors at the original specificity so forced-colors overrides remain authoritative
  • adds focused cross-browser Playwright coverage for system, explicit theme, dynamic removal, and forced-colors behavior

Fixes #2999.
Supersedes #3000.

Prior art

This replacement is based on current master, omits the unrelated virtual-keyboard cleanup from #3000, and uses :where() to avoid raising selector specificity above the later forced-colors rules.

Testing

  • Focused theme Playwright suite: 6/6 passing in Chromium, Firefox, and WebKit.
  • Unit and declaration suites: passing (348 unit tests and 256 snapshots).
  • Full Playwright suite: 271 passing, 4 skipped, with one pre-existing WebKit context-menu failure (mouse.spec.ts, expected x+y=30, received an empty value) that reproduces in isolation and is unrelated to these CSS changes.
  • npm run lint reports the existing no-restricted-globals error for speechSynthesis in src/public/math-static-elements.ts; changed files are formatted.

@SybelBlue

Copy link
Copy Markdown
Author

This was closed accidentally by our downstream workaround PR closing.

This branch has not been deployed

No deployments
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.

theme="light" attribute does not override prefers-color-scheme: dark

1 participant