-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI: Default white preview background #21593
UI: Default white preview background #21593
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a note to MIGRATION.md?
I felt I heard someone saying that SB dark mode (in manager UI) was only introduced in 7.0, which is what's caused this bug. But my memory might be wrong? |
I am noticing on |
Can you also change the Backgrounds addon to not default to light mode? (in the "cleared" state) |
I'm not sure what you mean by this @MichaelArestad . When it's cleared it doesn't set anything, as if it wasn't there? |
@JReinhold |
Aha I see what you mean, are you referring to #20982? I've reverted it as I think it makes sense. Any objections @ndelangen? |
…rowser-is-set-to-dark-mode
None @JReinhold |
Closes #21080
What I did
Set the preview iframe to default to a white background. Previously it was transparent, meaning that Storybook in dark mode would cause a dark background, which is unexpected given that browsers default to a white background - only the user's code should change the background color, not Storybook's code.
Setting the color on the iframe element ensures that user code that sets it on
html
,body
, or something else within the iframe still overrides it.I've tested that
How to test
Feel free to test this out locally with custom css in stories.
Checklist
MIGRATION.MD
Maintainers
make sure to add the
ci:merged
orci:daily
GH label to it.["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]