Repository navigation
fix(web): apply Storybook dark theme to portaled UI - #57
Merged
Merged
Conversation
Toggle .dark on document.documentElement (as ThemeProvider does) instead of a wrapper div, so dialogs, menus and popovers rendered into document.body follow the theme toolbar. Remove it on unmount so Light leaves no .dark on <html>. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
zooidbot
commented
Oct 7, 2026
zooidbot
left a comment
Collaborator
Author
There was a problem hiding this comment.
Reviewed against clients#42. No blocking findings.
- The fix matches the issue.
.darknow lives on<html>, so Radix portals indocument.bodypick up the variant. This is the same placetheme-provider.tsxputs it. - Leftover
.darkafter switching to Light: the code covers this, not just the cleanup. Whendarkchanges, the cleanup removes the class, and then the effect runsclassList.toggle("dark", false), which removes it explicitly. Nothing can leave it set. - Non-portaled stories: the inner
bg-background text-foreground p-6wrapper is unchanged, and&:is(.dark *)matches every descendant of<html>just as it matched every descendant of the old wrapper div. Rendering is the same in both themes.
So I'm treating both Not verified items as settled by reading the code. Merging once CI is green.
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 #42
Repro: in Storybook, select Dark in the Theme toolbar and open a dialog story (e.g.
dialogs-sharemessagedialog--no-room). The dialog renders light.Cause: the decorator wrapped stories in
<div className="dark">. The dark variant is&:is(.dark *), and Radix portals render intodocument.body, outside that div.Change:
packages/web/.storybook/preview.tsxnow toggles.darkondocument.documentElement(as ThemeProvider does) from aThemeRooteffect, and removes it on unmount.Knowledge impact: none (ZNC003's ThemeProvider contract is unchanged; this is a dev-harness fix)
Tests:⚠️ no-room Light renders light.
pnpm typecheckandpnpm testin packages/web pass (154 files, 981 tests). The repo has nolintscript. UX Tester (round 2; round 1 failed to start on a path error in my brief): ✅ no-room Dark, ✅ dropdown-open Dark (dialog and dropdown both dark),Not verified: that
<html>has no leftover.darkafter switching back to Light (UX Tester didn't check the class list; it relies on the effect cleanup/toggle). A non-portaled story (UI/Badge) in both themes was not checked, since UX Tester couldn't locate the story id. Both are worth a quick look in Storybook.Plan feedback: The issue named the right file and fix. My first UX Tester brief said
packages/webfor Storybook and it was appended to the worktree path twice, which cost a round. The issue also named no concrete non-portaled story id (UI/Badgewasn't found by id), so a specific one would help.🤖 Generated with Claude Code