From 41961f48724040fe9f0012cc9c28bcf33b9534b2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 03:11:13 +0000 Subject: [PATCH 1/4] feat(console): sidebar docking model - 1280 threshold, the expand/collapse button is the one control, recent lists this app (#36112) Windows 1280 px and up start with the sidebar expanded, 768 to 1279 px collapsed; the reader's own collapse or expand is kept per browser on each side of the threshold. The keep-open switch is removed; its stored choice reads as expanded on a narrow window. From 768 px up the sidebar's recent list holds only the current app's entries. Claude-Session: https://claude.ai/code/session_01FEkQ5oK4fFfnLADcipbEeT Co-Authored-By: Claude --- .../areas/platform-core.json | 10 +- .../app-showcase/e2e/detail-shapes.spec.ts | 42 ++- .../src/hooks/useResponsiveSidebar.ts | 66 ++-- .../app-shell/src/layout/UnifiedSidebar.tsx | 50 ++- .../src/layout/consoleSidebarRail.ts | 310 ++++++++---------- ui/packages/i18n/src/locales/ar.ts | 1 - ui/packages/i18n/src/locales/de.ts | 1 - ui/packages/i18n/src/locales/en.ts | 1 - ui/packages/i18n/src/locales/es.ts | 1 - ui/packages/i18n/src/locales/fr.ts | 1 - ui/packages/i18n/src/locales/ja.ts | 1 - ui/packages/i18n/src/locales/ko.ts | 1 - ui/packages/i18n/src/locales/pt-BR.ts | 1 - ui/packages/i18n/src/locales/ru.ts | 1 - ui/packages/i18n/src/locales/zh-Hans.ts | 1 - ui/packages/i18n/src/locales/zh-Hant.ts | 1 - .../src/synth/recordPageColumns.ts | 12 +- 17 files changed, 221 insertions(+), 280 deletions(-) diff --git a/docs/qa/platform-checklist/areas/platform-core.json b/docs/qa/platform-checklist/areas/platform-core.json index 38822ea39af..e9031e08b28 100644 --- a/docs/qa/platform-checklist/areas/platform-core.json +++ b/docs/qa/platform-checklist/areas/platform-core.json @@ -640,7 +640,7 @@ "title": "The built-in apps a stock boot REGISTERS (Setup / Account) render every merged-nav destination; app-level and entry-level gates are enforced, not errored — and Studio's deliberate absence is asserted, never hunted", "since": "v15", "status": "active", - "revision": 17, + "revision": 18, "priority": "P0", "surface": "browser", "personas": [ @@ -662,7 +662,7 @@ "steps": [ "as admin, GET /api/v1/meta/app?id=setup and extract every merged nav destination — Setup is a SHELL of empty group anchors (packages/platform-objects/src/apps/setup.app.ts: group_overview/apps/people_org/access_control/approvals/configuration/diagnostics/integrations/advanced) filled by SETUP_NAV_CONTRIBUTIONS (setup-nav.contributions.ts) plus capability-plugin contributions (plugin-security Positions/Permission Sets, plugin-sharing Sharing Rules/Record Shares, plugin-approvals, plugin-webhooks)", "GET /api/v1/meta/app with NO query first and record the names actually served — a stock boot answers exactly showcase_app, setup, account. Then GET /api/v1/meta/app?id=account (account.app.ts — Profile + Inbox/Security/Developer groups). ⚠️ GET /api/v1/meta/app?id=studio answers 200 {\"items\":[]} on every stock boot and that is the expected result (knownGap): record the absence as an assertion and move on — do NOT install @objectstack/studio to make the step runnable", - "as admin, hand-walk each destination in each app. At a window narrower than 1416 px (1280 px included) the console folds the sidebar, and Setup and Account open that way (ui/packages/app-shell/src/layout/consoleSidebarRail.ts CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH, objectstack#27593; QA run #29877 met it at 1280 px). Folded, the sidebar is hidden, with no icon column (ruling 6973617688 on objectstack#35062): press the sidebar toggle at the app bar's left edge (Ctrl/⌘+B), or rest the pointer on the window's left edge, to float the full menu over the page before expanding any group. The float folds back after each chosen entry, so float it again for the next destination. EXPAND every nav group first: some render collapsed by default — Setup's Advanced group and Account's Developer group declare `expanded: false` (packages/platform-objects/src/apps/setup.app.ts, account.app.ts), and QA run #24557 found Setup's Configuration group collapsed as well — so a walk that never expands them never reaches their entries. Then navigate, wait for render, SCREENSHOT FIRST, then read the DOM — assert no pageerror, no 'failed to load', no blank
, no 'no actions configured' placeholder", + "as admin, hand-walk each destination in each app. At a window narrower than 1280 px a browser with no choice kept opens Setup and Account with the sidebar collapsed, and from 1280 px expanded (ui/packages/app-shell/src/layout/consoleSidebarRail.ts CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH, ruling 7069868269 on objectstack#36112); a reader's own collapse or expand is kept per browser, on each side of that width. Collapsed, the sidebar is hidden, with no icon column (ruling 6973617688 on objectstack#35062): press the expand button at the page header's left edge to put it back beside the page before expanding any group — or press Ctrl/⌘+B, or rest the pointer on the window's left edge, to float the full menu over the page; the float folds back after each chosen entry, so float it again for the next destination. EXPAND every nav group first: some render collapsed by default — Setup's Advanced group and Account's Developer group declare `expanded: false` (packages/platform-objects/src/apps/setup.app.ts, account.app.ts), and QA run #24557 found Setup's Configuration group collapsed as well — so a walk that never expands them never reaches their entries. Then navigate, wait for render, SCREENSHOT FIRST, then read the DOM — assert no pageerror, no 'failed to load', no blank
, no 'no actions configured' placeholder", "Setup detail: confirm each settings URL entry (nav_settings_* → /apps/setup/system/settings/) opens the settings namespace form — the 11 namespaces of a stock single-posture boot, localization/company/branding/auth/access_policy/mail/sms/storage/ai/knowledge/lifecycle: the nav_settings_* entries of packages/platform-objects/src/apps/setup-nav.contributions.ts, plus nav_settings_branding, which packages/services/service-settings/src/settings-service-plugin.ts contributes only where no organization wall stands, and Users / Organization / Business Units / Teams / Sessions / OAuth Applications render. User preferences and identity links are not Setup destinations: open a user's record page, /_console/apps/setup/sys_user/record/ID (a row click on the Users list opens a side panel at ?recordId=, which is not that page: take the id from the row or the panel), and confirm the user page's Preferences and Linked Accounts tabs (packages/platform-objects/src/pages/sys-user.page.ts#SysUserDetailPage) render that user's rows", "Studio detail is NOT walked from here — the app is not registered on a stock boot (knownGap), so there is no merged nav to render. Its metadata:resource lists and component surfaces (App Builder, All Metadata Types, Packages, API Console, Flow Runs, Public Forms) are reached through the console surface at /_console/studio// and are covered by area studio-authoring. What THIS item asserts about Studio is the absence itself, per clause 6", "Account detail: confirm Profile (account:profile_card), Notifications (sys_inbox_message/mine), Approvals (nav_account_approvals, the approvals:inbox component, served as …/component/approvals/inbox — the Approvals Inbox, not the sys_approval_request grid; account.app.ts), Linked Accounts (sys_account), Active Sessions (sys_session/mine), API Keys (sys_api_key/mine), OAuth Applications (sys_oauth_application/mine) and Connect an Agent (nav_connect_agent) each render — 8 Account destinations and 47 Setup destinations for the admin on a stock single-org showcase boot, read from source after objectstack#34724 retired Setup › Packaged Actions (nav_packaged_actions; its switch moved onto the action in Studio); QA runs #32953 (at 5fb79bc0) and #33087 (at 8e3d4a54) read 48 before it (GET /api/v1/meta/app leaves, which match the nav source minus its gates). QA run #29877 read 46 at 589049b0, before Access policy (nav_settings_access_policy, the access_policy namespace) joined the Configuration group. Since QA run #28545's reading Setup's Packaged automation page retired under ADR-0146 D11, leaving Packaged Actions (nav_packaged_actions, automation:packaged-actions; #28785, itself retired by objectstack#34724), and its unfiltered Packages entry moved to Studio (#29547) (47 for #28927, 50 at eeec88d1 for QA run #28545, 48 re-measured at 3fd80337 for #28338, QA run #27481 read 44 and 8, QA run #24557 read 42 at 5b14b7f3, 45 on 2026-10-01, and #9453 recorded 43 and 7). Recount from the payload each run", @@ -822,6 +822,12 @@ "date": "2026-11-18", "change": "steps[2]: below 1416 px the fold now hides the sidebar instead of leaving its icon rail (ruling 6973617688 on #35062): the walk floats the full menu with the toggle (Ctrl/⌘+B) or by resting the pointer on the window's left edge, and floats it again after each chosen entry, since the float folds back on navigation. The walk is unchanged in substance. No clause changed. Read from source, and measured on a CRM boot (at 1280×800 the toggle floated the menu with focus on its entry; at 1600×900 choosing an entry in the float folded it); not yet re-run by a QA run.", "ref": "#35187" + }, + { + "revision": 18, + "date": "2026-11-22", + "change": "steps[2]: the threshold is 1280 px, not 1416 px, and it sets only where a browser with no choice kept starts — collapsed below it, expanded from it (ruling 7069868269 on #36112); the reader's own collapse or expand is kept per browser on each side, and the 'Keep sidebar open' switch is gone, so the walk docks the sidebar with the page header's expand button, or floats it with Ctrl/⌘+B or the window's left edge as before. The app bar named in revision 17 is gone from 768 px up (#36187). No clause changed. Read from source; not yet re-run by a QA run.", + "ref": "#36112" } ] }, diff --git a/examples/app-showcase/e2e/detail-shapes.spec.ts b/examples/app-showcase/e2e/detail-shapes.spec.ts index ba2fc5e7a5b..8e966126eae 100644 --- a/examples/app-showcase/e2e/detail-shapes.spec.ts +++ b/examples/app-showcase/e2e/detail-shapes.spec.ts @@ -178,30 +178,28 @@ test('related-heavy: body tables, the tab row and the rail on Contoso', async ({ // // The window and the sidebar are derived, not picked. A collapsed console // sidebar draws no icon rail from 768 px up — ruling 6973617688 on - // objectstack#35062: "Both collapsed states hide the sidebar completely: - // the manual collapse (`UnifiedSidebar` `collapsible="icon"`) and the - // automatic fold between 768 px and the record-drawer threshold (#27593, - // `consoleSidebarRail.ts`, below 1416 px). No icon column remains." So in a - // fresh browser context no desktop window stacks: measured on this harness, - // from a 768 px window (`MOBILE_BREAKPOINT`, the desktop shell) to 1415 px - // the sidebar folds hidden and the record view is the whole window (two - // columns at 768), and from 1416 px it is expanded and the view is at least - // 1160. The case therefore docks the sidebar the way a reader does — the - // app bar's trigger floats the menu and its "Keep sidebar open" keeps the - // 256 px sidebar beside the page — and the view is the window minus it: - // one column at 1015 px (759 of view), two at 1016 px (760), the same after - // a reload. So the docked stack tier is a window of 768 to 1015 px. 900 - // sits inside it with headroom on both sides: 644 px of view against the - // 760 floor, 132 px above the mobile breakpoint. ⛔ Not 780 px with the - // sidebar left as it comes up: that window now draws two columns (780 px of - // view). ⛔ Not below 768 px: that is the mobile shell, where the off-canvas - // sidebar gives the view the whole window (stack below 760), but where the - // details draw no Invoices body table (measured at 720 and 740 px). + // objectstack#35062: "Both collapsed states hide the sidebar completely" — + // and a browser with no choice kept starts it collapsed below 1280 px and + // expanded from 1280 px (ruling 7069868269 on objectstack#36112, + // `consoleSidebarRail.ts` CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH). So in a fresh + // browser context no window below 1280 px stacks: the sidebar is hidden and + // the record view is the whole window (two columns at 768). The case + // therefore docks the sidebar the way a reader does — the page header's + // expand button puts the 256 px sidebar beside the page, and this browser + // keeps that choice — and the view is the window minus it: one column at + // 1015 px (759 of view), two at 1016 px (760). So the docked stack tier is + // a window of 768 to 1015 px. 900 sits inside it with headroom on both + // sides: 644 px of view against the 760 floor, 132 px above the mobile + // breakpoint. ⛔ Not 780 px with the sidebar left as it comes up: that + // window draws two columns (780 px of view). ⛔ Not below 768 px: that is + // the mobile shell, where the off-canvas sidebar gives the view the whole + // window (stack below 760), but where the details draw no Invoices body + // table (measured at 720 and 740 px). await page.setViewportSize({ width: 900, height: 800 }); const errors = await openRecord(page, recordUrl('showcase_account', contosoId)); - await page.locator('[data-sidebar="trigger"]').click(); - await page.getByTestId('sidebar-keep-open').click(); - await expect(page.getByTestId('sidebar-keep-open')).toHaveAttribute('aria-pressed', 'true'); + await page.getByTestId('shell-sidebar-expand').click(); + await expect(page.getByTestId('sidebar-collapse')).toBeVisible(); + await expect(page.getByTestId('shell-sidebar-expand')).toHaveCount(0); // objectstack#35891: no stage bar, no key-field strip; the heuristic stage // (account.status is a select named "status") is the header's tag. diff --git a/ui/packages/app-shell/src/hooks/useResponsiveSidebar.ts b/ui/packages/app-shell/src/hooks/useResponsiveSidebar.ts index e6776537b4a..c73fd4d8958 100644 --- a/ui/packages/app-shell/src/hooks/useResponsiveSidebar.ts +++ b/ui/packages/app-shell/src/hooks/useResponsiveSidebar.ts @@ -1,37 +1,37 @@ /** * useResponsiveSidebar * - * Folds the sidebar while the window is narrower than - * `CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH` (and wider than the phone breakpoint, - * where the drawer takes over), and unfolds it when the window widens again - * (objectstack#27593). Folded, the console's sidebar is hidden, and its full - * menu floats over the content from the window's left edge or the app bar's - * trigger (ruling 6973617688 on objectstack#35062; `consoleSidebarRail.ts`). - * A reader who keeps the sidebar open is left alone. Must be called inside a - * SidebarProvider context. + * Gives the console sidebar the state a window starts in, as the page loads + * and as the window crosses `CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH` (1280 px) or + * the phone breakpoint, where the drawer takes over: the reader's choice for + * that side of the threshold, else expanded on a wide window and collapsed on + * a narrow one (ruling 7069868269 on objectstack#36112). Collapsed, the + * console's sidebar is hidden, and its full menu floats over the content from + * the window's left edge or ⌘B (ruling 6973617688 on objectstack#35062; + * `consoleSidebarRail.ts`). Must be called inside a SidebarProvider context. * - * The fold is not the reader's choice, so it does not keep one: every open - * and close on a wide window is kept as the wide-window choice, and only - * those (objectstack#28079). A window that turns wide, or a load that opens - * wide, gets that choice back, whatever the fold, the float or a sidebar - * kept open on a narrow window did to the primitive's cookie meanwhile. + * It also keeps the reader's choices, each on its own side of the threshold: + * an open or close on a wide window is the wide-window choice + * (objectstack#28079), a close of the docked sidebar on a narrow window the + * narrow-window choice (the page header's expand button keeps the other + * half, `useConsoleSidebarRailPanel`). The float writes neither, and a state + * this hook gives a window is not a choice. * @module */ import { useLayoutEffect, useRef } from 'react'; import { useSidebar } from '@object-ui/components'; import { - readWideWindowOpen, - seedWideWindowOpen, + startingSidebarOpen, useConsoleSidebarRail, writeWideWindowOpen, } from '../layout/consoleSidebarRail.js'; export function useResponsiveSidebar() { const { open, setOpen } = useSidebar(); - const { wide, railMode } = useConsoleSidebarRail(); + const { desktop, wide, railMode, setNarrowOpen } = useConsoleSidebarRail(); const setOpenRef = useRef(setOpen); - const last = useRef<{ wide: boolean; railMode: boolean } | null>(null); + const last = useRef<{ desktop: boolean; wide: boolean; railMode: boolean; open: boolean } | null>(null); useLayoutEffect(() => { setOpenRef.current = setOpen; @@ -40,23 +40,25 @@ export function useResponsiveSidebar() { // A layout effect, so a window that opens narrow paints the hidden sidebar first. useLayoutEffect(() => { const previous = last.current; - last.current = { wide, railMode }; + last.current = { desktop, wide, railMode, open }; + if (!desktop) return; + // A load, or a window that crosses the threshold or leaves the phone: its starting state. + if (!previous || !previous.desktop || previous.wide !== wide) { + const start = startingSidebarOpen(wide); + last.current.open = start; + if (start !== open) setOpenRef.current(start); + return; + } if (wide) { - // A load that opens wide, or a window that turns wide: the reader's wide-window choice. - if (!previous?.wide) { - const wideOpen = readWideWindowOpen(); - if (wideOpen !== undefined && wideOpen !== open) { - setOpenRef.current(wideOpen); - return; - } - } - writeWideWindowOpen(open); + if (previous.open !== open) writeWideWindowOpen(open); return; } - // The fold takes over: a narrow load, a window that narrows, "keep open" turned off. - if (railMode && !previous?.railMode) { - seedWideWindowOpen(open); - setOpenRef.current(false); + // The narrow-window choice turned collapsed (in this tab or another) under an open sidebar. + if (railMode && !previous.railMode) { + if (open) setOpenRef.current(false); + return; } - }, [wide, railMode, open]); + // The reader collapsed the docked sidebar on a narrow window. + if (!railMode && previous.open && !open) setNarrowOpen(false); + }, [desktop, wide, railMode, open, setNarrowOpen]); } diff --git a/ui/packages/app-shell/src/layout/UnifiedSidebar.tsx b/ui/packages/app-shell/src/layout/UnifiedSidebar.tsx index 2ce69f7c464..2a546ffc5bc 100644 --- a/ui/packages/app-shell/src/layout/UnifiedSidebar.tsx +++ b/ui/packages/app-shell/src/layout/UnifiedSidebar.tsx @@ -39,7 +39,6 @@ import { ChevronRight, LayoutGrid, Layers, - Pin, Search, } from 'lucide-react'; import { NavigationRenderer, hasVisibleNavigationItems, type NavItemActionContext } from '@object-ui/layout'; @@ -56,6 +55,7 @@ import { useNavTargetColor, useNavTargetIcon } from '../hooks/useNavTargetIcon.j import { ContentItemTile, favoriteItemObject } from './contentItemTile.js'; import { recentItemObject } from '../console/home/recentItemTypeLabel.js'; import { readRecentObjects } from '../console/home/readRecentObjects.js'; +import { appSegmentOf } from '../console/home/appLastOpened.js'; import { useNavDocTargetCheck } from '../hooks/useNavDocTargetCheck.js'; import { useNavMemberGates } from '../hooks/useNavMemberGates.js'; import { matchAppBySegment } from '../utils/index.js'; @@ -200,12 +200,12 @@ export function UnifiedSidebar({ activeAppName, onAppChange, railOverlay = false const resolveNavTargetIcon = useNavTargetIcon(); const resolveNavTargetColor = useNavTargetColor(); // Collapsed, the console's sidebar is hidden and its menu floats over the - // content (objectstack#35062); below the fold width it collapses on its own - // (objectstack#27593), and `useResponsiveSidebar` folds and unfolds it. + // content (objectstack#35062); a window starts in the reader's choice for + // its side of the threshold, else expanded from 1280 px and collapsed below + // (objectstack#36112), and `useResponsiveSidebar` gives it that state. const rail = useConsoleSidebarRail({ enabled: railOverlay }); const sidebarRef = React.useRef(null); const railPanel = useConsoleSidebarRailPanel(rail, sidebarRef); - const keepOpenLabel = t('sidebar.keepOpen', { defaultValue: 'Keep sidebar open' }); // objectstack#36112 — from 768 px up the console draws no top bar: the // sidebar starts at the top of the window and carries the app menu, the // search and the bell in its head, and the account at its foot. @@ -249,10 +249,6 @@ export function UnifiedSidebar({ activeAppName, onAppChange, railOverlay = false }, [routeKey, isMobile, setOpenMobile]); const { recentItems: allRecentItems } = useRecentItems(); - // A Studio package entry is labelled from the package list (objectui#11863), - // which this sidebar does not load, so it is left out here rather than drawn - // as its id. The Studio landing lists the recent packages. - const recentItems = allRecentItems.filter(item => item.type !== 'package'); // A recent entry's text is the item's own, resolved on this render // (objectui#11678); the entry stores identity only. const recentLabel = useRecentItemLabel(); @@ -268,7 +264,19 @@ export function UnifiedSidebar({ activeAppName, onAppChange, railOverlay = false // direct navigation to /apps/account still renders. const activeApps = apps.filter((a: any) => a.active !== false && a.hidden !== true); // ADR-0048 (A) — route segment may be a package id; match by it (name fallback). - const activeApp = matchAppBySegment(apps.filter((a: any) => a.active !== false), activeAppName || currentAppName) || activeApps[0]; + const enabledApps = apps.filter((a: any) => a.active !== false); + const activeApp = matchAppBySegment(enabledApps, activeAppName || currentAppName) || activeApps[0]; + // A Studio package entry is labelled from the package list (objectui#11863), + // which this sidebar does not load, so it is left out here rather than drawn + // as its id. The Studio landing lists the recent packages. From 768 px up + // the list is this app's own (objectstack#36112, 「这个应用里的最近使用」): + // an entry was opened in the app its address names, resolved as the router + // resolves it; Home lists every app's. The phone drawer is unchanged. + const recentItems = allRecentItems.filter( + (item) => + item.type !== 'package' && + (isMobile || (!!activeApp && matchAppBySegment(enabledApps, appSegmentOf(item.href)) === activeApp)), + ); // `type: 'action'` nav items dispatch through here (framework#4509). The // sidebar renders inside ConsoleShell's GlobalActionRuntimeProvider, so this // resolves to the fully-wired console runner — confirm/param/result dialogs @@ -910,29 +918,9 @@ export function UnifiedSidebar({ activeAppName, onAppChange, railOverlay = false )} - {/* "Keep sidebar open": in the floated menu it puts the sidebar back - beside the content and keeps it there (on the fold, for this - browser); in a sidebar kept open on a narrow window it is pressed, - and turns the fold back on (objectstack#35062). */} - {(railPanel.keepOpenControl || shellChrome) && ( + {shellChrome && ( - {railPanel.keepOpenControl && ( - - - - - {keepOpenLabel} - - - - )} - {shellChrome && } + )} {/* No footer trigger: from 768 px up the trigger is the head's collapse diff --git a/ui/packages/app-shell/src/layout/consoleSidebarRail.ts b/ui/packages/app-shell/src/layout/consoleSidebarRail.ts index c0e2ad1142e..a0b28815983 100644 --- a/ui/packages/app-shell/src/layout/consoleSidebarRail.ts +++ b/ui/packages/app-shell/src/layout/consoleSidebarRail.ts @@ -1,31 +1,32 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * consoleSidebarRail — how the console sidebar collapses, when it folds on its - * own, and the menu it floats over the content (objectstack#27593, - * objectstack#35062). + * consoleSidebarRail — how the console sidebar docks and collapses, which + * state a window starts in, and the menu it floats over the content + * (objectstack#27593, objectstack#35062, objectstack#36112). * - * From the phone breakpoint up a collapsed sidebar is hidden: it takes no - * width, and nothing of it is drawn, focusable or announced. Both ways of - * collapsing look the same (ruling 6973617688 on objectstack#35062: one - * collapsed look at 768 px and up): the reader's own collapse, and the fold - * below. The full menu, with its labels and groups, floats over the content - * instead, without changing what the reader chose: after the pointer rests on - * the window's left edge, after a press on that edge, and from the app bar's - * trigger or ⌘B, whichever way it collapsed. A pointer that floated it folds - * it back by moving away; a navigation choice, a press outside it or Esc folds - * it from any of them. "Keep sidebar open", at the foot of the floated menu, - * puts the sidebar back beside the content and keeps it there. + * From the phone breakpoint up the sidebar is docked beside the content or + * collapsed, and a collapsed sidebar is hidden: it takes no width, and nothing + * of it is drawn, focusable or announced (ruling 6973617688 on + * objectstack#35062: one collapsed look at 768 px and up). The sidebar's + * collapse button and, while it is collapsed, the page header's expand button + * are the one control (ruling 7069868269 on objectstack#36112): each press is + * the reader's choice, and this browser keeps it. * - * On a window too narrow for the record drawer and the list beside it next to - * an expanded sidebar, the sidebar folds on its own. A reader who keeps it - * open ({@link CONSOLE_SIDEBAR_KEEP_OPEN_PREFERENCE}) gets the wide-window - * behaviour at every width above the phone breakpoint, where the primitive's - * drawer takes over: the trigger collapses the sidebar, and floats its menu - * once it is collapsed. + * Which state a window starts in is that choice, kept separately for a wide + * window ({@link CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH} and up) and a narrow one + * (from the phone breakpoint to below it). With no choice kept, a wide window + * starts expanded and a narrow one collapsed. * - * `useResponsiveSidebar` folds and unfolds the sidebar as the window crosses - * the width; `UnifiedSidebar` draws the hidden sidebar, its edge and the float. + * Collapsed, the full menu, with its labels and groups, floats over the + * content without changing what the reader chose: after the pointer rests on + * the window's left edge, after a press on that edge, and from ⌘B. A pointer + * that floated it folds it back by moving away; a navigation choice, a press + * outside it or Esc folds it from any of them. + * + * `useResponsiveSidebar` gives each window its state as it loads and as it + * crosses the width, and keeps the reader's choices; `UnifiedSidebar` draws + * the hidden sidebar, its edge and the float. */ import { @@ -53,7 +54,7 @@ import { * The expanded sidebar's width in CSS pixels: the sidebar primitive's * `--sidebar-width` (16rem) in `@object-ui/components`. * `consoleSidebarRail.width-27593.test.tsx` reads the primitive's value and - * holds this equal to it, so the derived threshold below follows the sidebar. + * holds this equal to it. The width is fixed (objectstack#36112 F2). */ export const CONSOLE_EXPANDED_SIDEBAR_WIDTH = 256; @@ -61,8 +62,7 @@ export const CONSOLE_EXPANDED_SIDEBAR_WIDTH = 256; * The record drawer's width in CSS pixels: a list record opens in the drawer * at plugin-view's `md` overlay bucket, `overlayWidthFor('md', …)` = * `min(92vw, 720px)` (objectstack#27545). `consoleSidebarRail.width-27593.test.tsx` - * reads that value and holds this equal to it, so the derived threshold below - * follows the drawer. + * reads that value and holds this equal to it. */ export const RECORD_DRAWER_WIDTH = 720; @@ -75,33 +75,35 @@ export const RECORD_DRAWER_WIDTH = 720; export const LIST_MIN_COLUMNS_WIDTH = 440; /** - * The content width the record drawer needs over the full-width list: the - * drawer (720) and, beside it, the narrowest list that still draws its - * columns (440). - */ -export const RECORD_DRAWER_MIN_CONTENT_WIDTH = LIST_MIN_COLUMNS_WIDTH + RECORD_DRAWER_WIDTH; - -/** - * Below this window width the sidebar folds on its own. + * Below this window width a window with no choice kept starts with the + * sidebar collapsed; at it and above, expanded (ruling 7069868269 on + * objectstack#36112, 「1280 起默认展开,更窄才收起」). The one threshold: the + * wide and the narrow choice are kept on either side of it. * - * Derived, not picked: a window narrower than the drawer's content plus the - * expanded sidebar cannot keep the list's columns beside the open drawer with - * the sidebar expanded, so the sidebar gives the content its width. - * 1160 + 256 = 1416: a 1280 px window folds (the hidden sidebar leaves the - * drawer 560 px of list beside it, where the expanded sidebar would leave - * 304), a 1440 px window keeps the sidebar expanded (464 left). The record - * page's own column tiers are measured on the container it gets, so they - * follow either way. + * Chosen, not derived. The record drawer beside the narrowest list that still + * draws its columns, next to an expanded sidebar, needs 440 + 720 + 256 = + * 1416 px, the threshold before; the ruling accepts the cost below that. A + * 1280 px window with the sidebar expanded leaves the list beside an open + * record drawer 1280 − 256 − 720 = 304 px (560 with the sidebar collapsed), + * and on 1280 to 1415 px with the sidebar expanded, opening the record page's + * comment panel returns its fields to the tab row; collapsing the sidebar + * gives the content the width back. The record page's own column tiers are + * measured on the container it gets, so they follow either way. */ -export const CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH = RECORD_DRAWER_MIN_CONTENT_WIDTH + CONSOLE_EXPANDED_SIDEBAR_WIDTH; +export const CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH = 1280; /** - * The reader's "keep the sidebar open": `on` turns the fold off, so a narrow - * window keeps the wide-window sidebar. A reader preference, per browser, - * never metadata (objectstack#27052). With no choice: off. It changes when - * the sidebar collapses, never how a collapsed sidebar looks. + * The reader's narrow-window choice: `on` keeps the sidebar expanded on a + * window below {@link CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH}, `off` collapsed. A + * reader preference, per browser, never metadata (objectstack#27052). With no + * choice: collapsed. Only a collapse or expand on a narrow window by the + * reader writes it; the float never does. + * + * Kept under the name the retired "Keep sidebar open" switch used, which held + * the same choice: a reader who kept the sidebar open starts expanded on a + * narrow window (ruling 7069868269 on objectstack#36112). */ -export const CONSOLE_SIDEBAR_KEEP_OPEN_PREFERENCE = defineWorkspacePreference({ +export const CONSOLE_SIDEBAR_NARROW_OPEN_PREFERENCE = defineWorkspacePreference({ name: 'console.sidebar.keepOpen', codec: versionedPreferenceCodec({ version: 1, @@ -110,21 +112,24 @@ export const CONSOLE_SIDEBAR_KEEP_OPEN_PREFERENCE = defineWorkspacePreference