Storybook: Story background stays white in dark mode on docs page
Maintainers usually reply within 3 days
Assessment
This issue has not been assessed yet.
Description
Describe the bug
On the Storybook Docs pages that show all stories of a component, switching the theme to dark in the toolbar changes the components to their dark mode colours, but the page and the story preview containers keep their white background. Components are therefore shown with dark mode colours on a white background, which makes the dark theme useless for reviewing them on Docs pages. Single story pages are not affected and render the dark background correctly.
To Reproduce
- Run
pnpm storybook(or open the deployed Storybook) - Open the Docs page of any component, e.g. Components → Badge → Docs
- Switch the theme in the toolbar from light to dark
- See the components change colours while the background stays white
Expected behavior
The Docs page, including the story preview containers, uses the dark surface colour (--colour-surface-base, #18181b) when the dark theme is active, the same as the Canvas view does.
Actual behavior
The Docs page stays white. Single story pages are fine: there the html element gets the dark class and the dark background from the .__sb_preview_background rule in src/assets/styles/main.css. On Docs pages, the html element also gets the dark class and the dark background, but the docs wrapper rendered by @storybook/addon-docs (.sbdocs-wrapper) paints its own white background on top of it. The story containers are transparent, so they show that white.
Screenshots
System
- Storybook 10.6.7 with @storybook/addon-themes (withThemeByClassName in .storybook/preview.ts) and @storybook/addon-docs
- Reproduced in Chromium
Additional context
A possible fix is to give .sbdocs-wrapper the theme's surface colour in dark mode, next to the existing Storybook-only rules in main.css. The docs text (headings, descriptions, args table) would then also need dark mode colours to stay readable. Alternatively, the docs theme could follow the selected theme (parameters.docs.theme), but that is static by default and would need a custom docs container.
- Dominant language
- Vue
- Stars
- 10
- Forks
- 1
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from thunderbird/services-ui
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
thunderbird/services-ui#354 ·
Maintainers usually reply within 3 days
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
thunderbird/services-ui#356 ·
Maintainers usually reply within 3 days
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
thunderbird/services-ui#334 · 1 comment ·
Maintainers usually reply within 3 days
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 70/100
thunderbird/services-ui#326 · 2 comments ·
Maintainers usually reply within 3 days
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 68/100
thunderbird/services-ui#325 ·
Maintainers usually reply within 3 days