Skip to content
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

Storybook's own styles are overwriting my component styles #16545

Closed
wiktoriavh opened this issue Nov 1, 2021 · 6 comments
Closed

Storybook's own styles are overwriting my component styles #16545

wiktoriavh opened this issue Nov 1, 2021 · 6 comments

Comments

@wiktoriavh
Copy link

wiktoriavh commented Nov 1, 2021

Describe the bug
I have an h2 element with styles:

h2 {
  display: block;
}

But because of Storybook's own styling in the DOM, it becomes

h2 {
  display: inline-block;
}

And it messes everything up.

To Reproduce
Just have a h2 Element with styles applied, like in the example above.

System
// Please paste the results of npx sb@next info here.

Additional context
Writing my stories in MDX. This issue appears in the Docs and the Canvas panel.

@DarkCode01
Copy link

DarkCode01 commented Nov 4, 2021

I have the same issue!

@wiktoriavh
Copy link
Author

wiktoriavh commented Nov 8, 2021

I was able to fix my issue by adding the CssBaseline into a decorator in preview.js from Material UI.

@ed-asriyan
Copy link

I have the same issue.
Elements with .loader class in a story are not displayed as I expect. Using devtools I found that these rules are applied to my component.

Versions that I use:
@storybook/addon-actions@6.4.0
@storybook/addon-essentials@6.4.0
@storybook/addon-links@6.4.0
@storybook/vue@6.4.0

v6.3.12 does not have this problem

@shilman
Copy link
Member

shilman commented Nov 26, 2021

@ed-asriyan Do you a have a reproduction repo you can share? Is this in both the docs and canvas tabs?

@ed-asriyan
Copy link

ed-asriyan commented Nov 26, 2021

@shilman

Do you a have a reproduction repo you can share?

You can find the reproduction repo here: https://github.com/ed-asriyan/storybook-bug-sample. In ReadMe you can also find screenshot of the bug.

Is this in both the docs and canvas tabs?

It is surely reproducing in canvas. I have not yet become familiar with Storybook docs API well enough, so I can not answer about docs.

@shilman
Copy link
Member

shilman commented Dec 1, 2021

Son of a gun!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.2 containing PR #16815 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants