Skip to content

Fix storybook dark mode - #360

Merged
devmount merged 2 commits into
mainfrom
bugs/359-fix-storybook-dark-mode
Nov 18, 2026
Merged

devmount merged 2 commits into
mainfrom
bugs/359-fix-storybook-dark-mode

Conversation

@devmount

Copy link
Copy Markdown
Collaborator

What changed?

  1. Storybook Docs pages now follow the light/dark theme selected in the toolbar. A custom docs container in .storybook/preview.ts renders Storybook's DocsContainer with the dark or light docs theme, so page background, story previews, text, args table and controls switch together.
  2. Set rootDir in .storybook/tsconfig.json to the repo root, which fixes an TS6059 error my IDE showed for imports from src/

Why?

On docs pages showing all stories of a component, switching to dark mode changed the component colors, but the page and story containers stayed white, which defeated the purpose of reviewing components on a dark background. Single story pages were not affected.

Limitations and Notes

  • The current theme is read from the docs context's internal store, since the public API (storyById) throws on Docs pages without stories, like the Readme. A future Storybook update could change this.
  • Dark Docs pages use Storybook's dark grey (#222325) instead of our surface color (#18181b). This could be aligned with a custom docs theme if needed.

Applicable Issues

Closes #359

QA Log

  • Checked Docs pages in a headless browser against the Storybook dev server: light and dark on load, switching the theme on an open page in both directions, the Readme page without stories, and single story pages. No console errors.
  • Ran lint, type-check, component tests, Storybook a11y tests, build, build:ce and build-storybook.
  • Manually checked several docs pages

Screenshots

Before After
services-ui-dark-mode-before services-ui-dark-mode-after

@devmount devmount self-assigned this Nov 18, 2026

@aaspinwall aaspinwall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lookin' good!

@devmount
devmount merged commit 70eed3a into main Nov 18, 2026
5 checks passed
@devmount
devmount deleted the bugs/359-fix-storybook-dark-mode branch November 18, 2026 14:37
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.

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

2 participants