@@ -8,7 +8,7 @@ export const withContextWrapper = makeDecorator({
8
8
name : "withContextWrapper" ,
9
9
parameterName : "context" ,
10
10
wrapper : ( StoryFn , context ) => {
11
- const { args, argTypes, viewMode , id } = context ;
11
+ const { args, argTypes, id , viewMode } = context ;
12
12
13
13
const getDefaultValue = ( type ) => {
14
14
if ( ! type ) return null ;
@@ -32,6 +32,14 @@ export const withContextWrapper = makeDecorator({
32
32
33
33
useEffect ( ( ) => {
34
34
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 ) ;
35
43
36
44
const roots = [
37
45
...document . querySelectorAll ( `#story--${ id } ` ) ,
@@ -60,7 +68,8 @@ export const withContextWrapper = makeDecorator({
60
68
if ( hasStaticElement ) {
61
69
if ( container . querySelector ( `.${ args . rootClass } --staticBlack` ) ) {
62
70
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` ) ) {
64
73
container . style . background = "rgb(15, 121, 125)" ;
65
74
}
66
75
}
0 commit comments