Storybook: Story background stays white in dark mode on docs page

Aperta
#359 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

@devmount ci sta già lavorando.

Dal 18/11/2026.

  • #360 di @devmount — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

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

  1. Run pnpm storybook (or open the deployed Storybook)
  2. Open the Docs page of any component, e.g. Components → Badge → Docs
  3. Switch the theme in the toolbar from light to dark
  4. 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

image

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.

Lingua principale
Vue
Stelle
10
Fork
1
Merge medio
1g 22h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di thunderbird/services-ui

Tutte le issue di thunderbird/services-ui

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.