@@ -127,12 +127,15 @@ export interface UIState {
127127
128128const query = new URL ( document . location . href ) . searchParams ;
129129const isEmbeddedInAnIframe = window . self !== window . top ;
130+ // @TODO : Centralize these breakpoint sizes.
131+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
132+ const isMobile = window . innerWidth < 875 ;
130133
131134// Parse the route parameter for sidebar/tab state
132135const routeState = parseRouteParam ( query . get ( 'route' ) ) ;
133136
134137// Check if there's an explicit route param requesting the sidebar to be open.
135- // If so, respect it regardless of viewport size (but not in seamless mode).
138+ // If so, respect it regardless of viewport size (but not in seamless mode or iframes ).
136139const hasExplicitRouteParam = query . has ( 'route' ) && routeState . sidebarOpen ;
137140const isSeamlessMode = query . get ( 'mode' ) === 'seamless' ;
138141
@@ -153,11 +156,18 @@ const initialState: UIState = {
153156 activeTab : routeState . tab || 'settings' ,
154157 offline : ! navigator . onLine ,
155158
156- // The site manager should not be shown at all in seamless mode or in iframes.
157- // Otherwise, if there's an explicit route param requesting it open, respect that.
158- // If no route param, default to closed (mobile or not).
159+ // NOTE: Please do not eliminate the cases in this siteManagerIsOpen expression,
160+ // even if they seem redundant. We may experiment with toggling the manager
161+ // to be open by default or closed by default, and we do not want to lose
162+ // specific reasons for the manager to be closed.
159163 siteManagerIsOpen :
160- ! isSeamlessMode && ! isEmbeddedInAnIframe && hasExplicitRouteParam ,
164+ // The site manager should not be shown at all in seamless mode.
165+ ! isSeamlessMode &&
166+ // We do not expect to render the Playground app UI in an iframe.
167+ ! isEmbeddedInAnIframe &&
168+ // If there's an explicit route param requesting sidebar open, respect it.
169+ // Otherwise default to closed on all viewport sizes.
170+ hasExplicitRouteParam ,
161171 siteManagerSection : routeState . section ,
162172} ;
163173
0 commit comments