Repository navigation
Keep the dark theme on example pages - #685
Merged
Merged
Conversation
The theme was set only by the docs layout and site nav, and each put the page root back to light when it unmounted. Example pages mount neither, so opening one from /examples, or reloading it, showed the light theme. index.html now sets the theme before the first paint on every page, the theme hook no longer reverts the root, and the example header has its own theme toggle. Closes #672 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
In dark mode on the docs site, opening an example from
/examplesswitched the page to light. Now the theme holds on example pages, through client navigation and reloads, with no light flash. Example pages also get their own theme toggle.Before:
/examplesis dark. Click an example and the workspace opens in light. A reload of the example page also shows light.After: The example opens dark and stays dark after a reload. Light mode works the same way.
Closes #672
Cause
Only the docs layout and the site nav applied the theme, and each set the page root back to light when it unmounted. Example pages mount neither, so they always fell back to light. Nothing set the theme before the first paint on a reload.
The fix:
index.htmlsets the theme before the first paint on every page, and the theme hook no longer reverts the root when it unmounts.Proof
Dark system theme: open
/examples, click the first example (/examples/january-flights).After a reload of the example page, this branch is still dark:
Playwright checks of the page root's
darkclass. The value atDOMContentLoadedshows the theme is set before the app renders, so there is no flash.The new toggle on the example page switches to dark, and the saved choice beats a light system theme after a reload. The example header at 390 px fits with no page overflow (also checked at 783 and 1280):
pnpm lintpasses;LandingPage.test.tsxpasses (22 tests).Limits
/folderkeeps its own theme setting once a folder is open. Before a folder opens, the picker page now shows the site theme.🤖 Generated with Claude Code