-
-
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
Storybook styles given higher precedence than project styles #12423
Comments
Perhaps you can put your stories in iframes to stop the style conficts? https://storybook.js.org/docs/react/writing-docs/doc-blocks#inline-rendering |
That is absolutely what I was missing, so to turn it off by default I would want to add: // preview.js
import "../src/index.scss";
export const parameters = {
docs: {
inlineStories: false,
},
}; That seems like an odd thing to have on by default since it definitely messes with style resets, but thank you so much for pointing me towards a solution! |
@DaveLo rendering multiple iframes on the page has performance issues |
I have a similar issue occurring now, but it only seems to affect the Setting I am currently on storybook Storybook 6.3.8, I recently upgrade form 6.2.9 (this issue was also present in that version). The following styles are set by storybook:
The only real 'solution' I found to this problem is to basically manually overwrite each of these settings in my global styles sheet. Not ideal... I am also a bit concerned as I don't know what else might be inadvertently affected by storybook styles. |
Same issue here, version |
Also just encountered this - any component using |
Also having the issue with Temp hack in the story: export const StoryComponent = Template.bind({});
StoryComponent.play = () => {
document.querySelector('section').style.maxWidth = 'inherit';
}; No idea what kind of side effects that will have, but it is at least confined to storybook and not a tweak to component styles. |
@shilman can one reopen this issue? Its not resolved and does have some direct side-effects that affect how our applications behave. |
@matthewhampton haha, ok, this is so obvious in hindsight. Thank you for picking up on this. @shilman an overengineered idea might be to add a painfully obvious disclaimer on the bootstrapped Storybook CSS files stating CSS is global and not deleting the boilerplate CSS can have consequences for other components imported into Storybook. Is it overkill to do something like that? Maybe, but clearly, a few people have had issues with these unintended side effects ;-) |
@ArmanNisch I think it's being addressed here #19433 |
Boo-yah!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.1.0-alpha.14 containing PR #22162 that references this issue. Upgrade today to the
|
Jeepers creepers!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.10 containing PR #22162 that references this issue. Upgrade today to the
|
If you are reporting a bug or requesting support, start here:
Bug or support request summary
I'm importing my base style reset in preview.js, it does normal reset things and also sets our app fonts. However when I load storybook I end up with
overriding my set default line-height, font-family, etc. This causes an obvious issue for component development.
I'm sure there is some setting I need to change or something I'm missing but I'm basically using storybook 6 out of the box in a CRA typescript project. I've installed the preset scss since we use Sass
If there is a class set on an element it wins out in specificity, but all of the app defaults seem to lose.
This is coming from an experiment in using MDX in case that is relevant?
The text was updated successfully, but these errors were encountered: