From a73a4c3db63fa74476965102907170884b18e1c6 Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Mon, 9 Mar 2026 09:24:31 +0500 Subject: [PATCH 1/4] fix issue 33735: Global background + color styles affecting stories --- .../core/assets/server/base-preview-head.html | 147 +++++++++--------- 1 file changed, 73 insertions(+), 74 deletions(-) diff --git a/code/core/assets/server/base-preview-head.html b/code/core/assets/server/base-preview-head.html index dacc8ef5d52c..4f58f5d6346b 100644 --- a/code/core/assets/server/base-preview-head.html +++ b/code/core/assets/server/base-preview-head.html @@ -112,11 +112,11 @@ border-radius: 10px; background: rgb(247, 247, 247); color: rgb(46, 52, 56); + } - & * { - background: rgb(247, 247, 247); - color: rgb(46, 52, 56); - } + .sb-nopreview_main * { + background: rgb(247, 247, 247); + color: rgb(46, 52, 56); } .sb-nopreview_heading { @@ -147,84 +147,83 @@ border: 1px solid #ff0000; box-shadow: 0 0 64px rgba(0, 0, 0, 0.1); gap: 24px; + } - & ol { - padding-left: 18px; - margin: 0; - } + .sb-errordisplay_main ol { + padding-left: 18px; + margin: 0; + } - /* Redefine colors to ensure readability regardless of user-provided * selectors. */ - * { - background: white; - color: black; - } + /* Redefine colors to ensure readability regardless of user-provided * selectors. */ + .sb-errordisplay_main * { + background: white; + color: black; + } - & h1 { - font-family: Nunito Sans; - font-size: 22px; - font-weight: 400; - line-height: 30px; - font-weight: normal; - margin: 0; - - &::before { - content: ''; - display: inline-block; - width: 12px; - height: 12px; - background: #ff4400; - border-radius: 50%; - margin-right: 8px; - } - } + .sb-errordisplay_main h1 { + font-family: Nunito Sans; + font-size: 22px; + font-weight: 400; + line-height: 30px; + font-weight: normal; + margin: 0; + } - & p, - & ol { - font-family: Nunito Sans; - font-size: 14px; - font-weight: 400; - line-height: 19px; - margin: 0; - } + .sb-errordisplay_main h1::before { + content: ''; + display: inline-block; + width: 12px; + height: 12px; + background: #ff4400; + border-radius: 50%; + margin-right: 8px; + } - & li + li { - margin: 0; - padding: 0; - padding-top: 12px; - } + .sb-errordisplay_main p, + .sb-errordisplay_main ol { + font-family: Nunito Sans; + font-size: 14px; + font-weight: 400; + line-height: 19px; + margin: 0; + } - & a { - color: currentColor; - } + .sb-errordisplay_main li + li { + margin: 0; + padding: 0; + padding-top: 12px; + } - & .sb-errordisplay_code { - padding: 10px; - flex: 1; - background: #242424; - color: #c6c6c6; - box-sizing: border-box; - - font-size: 14px; - font-weight: 400; - line-height: 19px; - border-radius: 4px; - - font-family: - 'Operator Mono', 'Fira Code Retina', 'Fira Code', 'FiraCode-Retina', 'Andale Mono', - 'Lucida Console', Consolas, Monaco, monospace; - margin: 0; - overflow: auto; - - & code { - background-color: inherit; - color: inherit; - } - } + .sb-errordisplay_main a { + color: currentColor; + } - & .sb-errordisplay pre { - white-space: pre-wrap; - white-space: revert; - } + .sb-errordisplay_main .sb-errordisplay_code { + padding: 10px; + flex: 1; + background: #242424; + color: #c6c6c6; + box-sizing: border-box; + + font-size: 14px; + font-weight: 400; + line-height: 19px; + border-radius: 4px; + + font-family: + 'Operator Mono', 'Fira Code Retina', 'Fira Code', 'FiraCode-Retina', 'Andale Mono', + 'Lucida Console', Consolas, Monaco, monospace; + margin: 0; + overflow: auto; + } + + .sb-errordisplay_main .sb-errordisplay_code code { + background-color: inherit; + color: inherit; + } + + .sb-errordisplay_main .sb-errordisplay_code { + white-space: pre-wrap; } @-webkit-keyframes sb-rotate360 { From f04aacff6908ec4342257aef04a2f21e5224e033 Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Mon, 9 Mar 2026 09:37:38 +0500 Subject: [PATCH 2/4] update issue according to coderabbitai --- code/core/assets/server/base-preview-head.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/core/assets/server/base-preview-head.html b/code/core/assets/server/base-preview-head.html index 4f58f5d6346b..864a60ee2701 100644 --- a/code/core/assets/server/base-preview-head.html +++ b/code/core/assets/server/base-preview-head.html @@ -160,6 +160,13 @@ color: black; } + /* Exclude error code block from the universal reset to preserve ANSI colors and dark theme */ + .sb-errordisplay_main .sb-errordisplay_code, + .sb-errordisplay_main .sb-errordisplay_code * { + background: #242424; + color: #c6c6c6; + } + .sb-errordisplay_main h1 { font-family: Nunito Sans; font-size: 22px; From 95112ec8c2f9724fe3889efa1928f815a36d79e6 Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Mon, 9 Mar 2026 09:52:49 +0500 Subject: [PATCH 3/4] remove duplication font-weight and add quote on font-family --- code/core/assets/server/base-preview-head.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/core/assets/server/base-preview-head.html b/code/core/assets/server/base-preview-head.html index 864a60ee2701..2cebfeb7a833 100644 --- a/code/core/assets/server/base-preview-head.html +++ b/code/core/assets/server/base-preview-head.html @@ -168,11 +168,10 @@ } .sb-errordisplay_main h1 { - font-family: Nunito Sans; + font-family: 'Nunito Sans'; font-size: 22px; font-weight: 400; line-height: 30px; - font-weight: normal; margin: 0; } @@ -188,7 +187,7 @@ .sb-errordisplay_main p, .sb-errordisplay_main ol { - font-family: Nunito Sans; + font-family: 'Nunito Sans'; font-size: 14px; font-weight: 400; line-height: 19px; From d177fb1c27393cdf7bf1d4e4a10267a931d14000 Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Mon, 9 Mar 2026 10:01:17 +0500 Subject: [PATCH 4/4] inherit font family --- code/core/assets/server/base-preview-head.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/core/assets/server/base-preview-head.html b/code/core/assets/server/base-preview-head.html index 2cebfeb7a833..4e2ca7f30ef6 100644 --- a/code/core/assets/server/base-preview-head.html +++ b/code/core/assets/server/base-preview-head.html @@ -168,7 +168,7 @@ } .sb-errordisplay_main h1 { - font-family: 'Nunito Sans'; + font-family: inherit; font-size: 22px; font-weight: 400; line-height: 30px; @@ -187,7 +187,7 @@ .sb-errordisplay_main p, .sb-errordisplay_main ol { - font-family: 'Nunito Sans'; + font-family: inherit; font-size: 14px; font-weight: 400; line-height: 19px;