You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed in my production build that some elements in my stories were affected by some styles from Storybook. I investigated the issue and found out that base-preview-head.html as some nested styles under .sb-errordisplay
When i do a production build and check the output of iframe.html the styles are not scope to .sb-errordisplay anymore:
** Disclaimer** This information might be inaccurate, due to it being generated automatically
The issue is in the CSS scoping of base-preview-head.html styles. The fix requires: 1. Update the CSS in code/core/assets/server/base-preview-head.html to ensure styles are properly scoped: css .sb-errordisplay { /* existing styles */ } .sb-errordisplay h1, .sb-errordisplay h2, .sb-errordisplay h3, .sb-errordisplay h4 { /* heading styles should be scoped here */ } 2. Ensure the build process in code/builder-vite correctly preserves CSS scoping during production builds. 3. Add CSS specificity to prevent style leakage: css .sb-show-main #storybook-root h1 { /* reset any inherited styles */ all: revert; }
About Greptile
This response provides a starting point for your research, not a precise solution.
Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
Describe the bug
I noticed in my production build that some elements in my stories were affected by some styles from Storybook. I investigated the issue and found out that base-preview-head.html as some nested styles under .sb-errordisplay
When i do a production build and check the output of iframe.html the styles are not scope to .sb-errordisplay anymore:
Chrome applies this style to my h1 in a Canvas:

Reproduction link
https://stackblitz.com/edit/github-eayf3yj9?file=storybook-static%2Fiframe.html&preset=node
Reproduction steps
I was able to reproduce on StackBlitz using your Vite+TS setup.
Simply call the build command and check output iframe.html
System
Additional context
No response
The text was updated successfully, but these errors were encountered: