Skip to content

fix Storybook dark preview background#563

Merged
bgentry merged 1 commit into
masterfrom
bg/storybook-upgrade
May 8, 2026
Merged

fix Storybook dark preview background#563
bgentry merged 1 commit into
masterfrom
bg/storybook-upgrade

Conversation

@bgentry
Copy link
Copy Markdown
Contributor

@bgentry bgentry commented May 8, 2026

Storybook's preview body file used nested html and body tags, but browsers discard that structure inside the preview iframe. As a result, dark-mode stories could render on the wrong background and make visual review misleading.

This replaces the invalid markup with a small style block that targets the actual preview body, including the root .dark class that Storybook applies for dark mode.

@bgentry bgentry requested a review from brandur May 8, 2026 02:23
Storybook's `preview-body.html` was trying to inject nested `html` and
`body` tags. Browsers strip that structure in the preview iframe, so the
dark background never applied and dark-mode UI changes were reviewed
against the wrong canvas.

Replace the invalid markup with a small style block that targets the real
preview `body`, and use `.dark body` so it follows Storybook's theme
class on the root element. This makes dark-mode component previews match
the app background and gives UI changes a trustworthy review surface.
@bgentry bgentry force-pushed the bg/storybook-upgrade branch from fcd5161 to cde9fcb Compare May 8, 2026 02:30
@bgentry bgentry changed the title Upgrade storybook, fix dark preview background fix Storybook dark preview background May 8, 2026
@bgentry bgentry merged commit 90e62e3 into master May 8, 2026
21 checks passed
@bgentry bgentry deleted the bg/storybook-upgrade branch May 8, 2026 02:32
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.

2 participants