Skip to content

Commit bfa708f

Browse files
committed
Fix: Default sidebar to open on desktop, use route param as override
1 parent 42e5919 commit bfa708f

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

packages/playground/website/src/lib/state/redux/slice-ui.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,20 @@ export interface UIState {
128128
const query = new URL(document.location.href).searchParams;
129129
const isEmbeddedInAnIframe = window.self !== window.top;
130130
// @TODO: Centralize these breakpoint sizes.
131-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
132131
const isMobile = window.innerWidth < 875;
133132

134133
// Parse the route parameter for sidebar/tab state
135134
const routeState = parseRouteParam(query.get('route'));
136-
137-
// Check if there's an explicit route param requesting the sidebar to be open.
138-
// If so, respect it regardless of viewport size (but not in seamless mode or iframes).
139-
const hasExplicitRouteParam = query.has('route') && routeState.sidebarOpen;
140135
const isSeamlessMode = query.get('mode') === 'seamless';
141136

137+
// Determine initial sidebar open state:
138+
// - If route param exists, use it (route=closed → closed, otherwise → open)
139+
// - If no route param, default to open on desktop, closed on mobile
140+
const hasExplicitRouteParam = query.has('route');
141+
const shouldSidebarBeOpen = hasExplicitRouteParam
142+
? routeState.sidebarOpen
143+
: !isMobile;
144+
142145
const initialState: UIState = {
143146
/**
144147
* Don't show certain modals after a page refresh.
@@ -165,9 +168,8 @@ const initialState: UIState = {
165168
!isSeamlessMode &&
166169
// We do not expect to render the Playground app UI in an iframe.
167170
!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,
171+
// Use explicit route param if provided, otherwise default based on viewport.
172+
shouldSidebarBeOpen,
171173
siteManagerSection: routeState.section,
172174
};
173175

plugins/blocky-formats

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 372b8820fff1d49f24f865a6178d059a53e5df5b

pma/mysql-sqlite-network-proxy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit d0f8a46bfa5d4465e1bf87f50d401d71ff7b6d2d

0 commit comments

Comments
 (0)