@@ -8,7 +8,7 @@ export const withContextWrapper = makeDecorator({
88 name : "withContextWrapper" ,
99 parameterName : "context" ,
1010 wrapper : ( StoryFn , context ) => {
11- const { args, argTypes, viewMode , id } = context ;
11+ const { args, argTypes, id , viewMode } = context ;
1212
1313 const getDefaultValue = ( type ) => {
1414 if ( ! type ) return null ;
@@ -32,6 +32,14 @@ export const withContextWrapper = makeDecorator({
3232
3333 useEffect ( ( ) => {
3434 let containers = [ document . body ] ;
35+ const container =
36+ viewMode === "docs" &&
37+ ! window . isChromatic ( ) &&
38+ ! id . includes ( "foundation" )
39+ ? document . querySelector ( "#root-inner" ) ?? document . body
40+ : document . body ;
41+
42+ container . classList . toggle ( "spectrum" , true ) ;
3543
3644 const roots = [
3745 ...document . querySelectorAll ( `#story--${ id } ` ) ,
@@ -60,7 +68,8 @@ export const withContextWrapper = makeDecorator({
6068 if ( hasStaticElement ) {
6169 if ( container . querySelector ( `.${ args . rootClass } --staticBlack` ) ) {
6270 container . style . background = "rgb(181, 209, 211)" ;
63- } else if ( container . querySelector ( `.${ args . rootClass } --staticWhite, .${ args . rootClass } --overBackground` ) ) {
71+ }
72+ else if ( container . querySelector ( `.${ args . rootClass } --staticWhite, .${ args . rootClass } --overBackground` ) ) {
6473 container . style . background = "rgb(15, 121, 125)" ;
6574 }
6675 }
0 commit comments