addon-backgrounds doesn't affect docs-mode
See original GitHub issueDescribe the bug addon-backgrounds only works in canvas mode, and has no effect whatsoever in docs-mode.
To Reproduce
- Setup storybook v5.2.0-beta/rc
- Add and configure addon-docs
- Add and configure addon-backgrounds
addParameters({})
on config.js with some default backgrounds (As per the addon-backgrounds instructions)- Run storybook
- Switch background color on canvas mode
- Go to docs-mode and notice that there’s no way to switch the background-color and the color defined in canvas mode has no effect
Expected behavior Preview blocks with toolbars should display a button to switch the background color of that block
Screenshots N/A
Code snippets N/A
System:
Environment Info:
System:
OS: macOS 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Binaries:
Node: 12.4.0 - ~/.asdf/installs/nodejs/12.4.0/bin/node
Yarn: 1.16.0 - ~/.asdf/installs/nodejs/12.4.0/.npm/bin/yarn
npm: 6.9.0 - ~/.asdf/installs/nodejs/12.4.0/bin/npm
Browsers:
Safari: 12.1.2
npmPackages:
@storybook/addon-a11y: 5.2.0-beta.45 => 5.2.0-beta.45
@storybook/addon-actions: 5.2.0-beta.45 => 5.2.0-beta.45
@storybook/addon-backgrounds: 5.2.0-beta.45 => 5.2.0-beta.45
@storybook/addon-docs: 5.2.0-beta.45 => 5.2.0-beta.45
@storybook/addon-knobs: 5.2.0-beta.45 => 5.2.0-beta.45
@storybook/addon-links: 5.2.0-beta.45 => 5.2.0-beta.45
@storybook/addon-viewport: ^5.1.11 => 5.1.11
@storybook/addons: 5.2.0-beta.45 => 5.2.0-beta.45
@storybook/preset-typescript: ^1.1.0 => 1.1.0
@storybook/react: 5.2.0-beta.45 => 5.2.0-beta.45
Additional context N/A
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:17 (8 by maintainers)
Top Results From Across the Web
@storybook/addon-backgrounds | Yarn - Package Manager
Storybook Addon Backgrounds can be used to change background colors inside the preview in Storybook.
Read more >Backgrounds - Storybook - JS.ORG
The backgrounds toolbar addon allows you to set the background color in which the story renders in the UI: Configuration. By default, the...
Read more >How to enable Google Docs dark mode on desktop and mobile
To enable dark mode in the Google Docs app on mobile, go to Settings and switch the theme to Dark. Dark mode is...
Read more >Help – Dark Reader
Note: If the toggle button is greyed-out, it means that browser restricts injecting scripts into current page. Filter settings. Filter settings. Adjust the...
Read more >Backgrounds - Oxygen Builder
Background blend modes allow you to set how an element's background image should blend with the element's background color or gradient.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I can confirm that I’m having the exact same problem. Works fine for CSF stories, not for MDX stories…
Hi @shilman ,
Your PR fixes the problem for DocsPage generated documentation, but not for manually written MDX stories in the style described here.
The code in the PR tries to set styles on the CSS selector
#anchor--${context.id} .docs-story
hereThis works for DocsPage since it generates Anchor components for every story. However this pattern is not documented in the MDX guide above, and actually seems to conflict with the behaviour of the Meta tag here, which generates a single Anchor component at the top of the page for the first Story encountered (which is a bit strange tbh).
Would it be possible to make the background selection work on any story regardless of whether they are contained in an anchor?