Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/36112-sidebar-docking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

feat(console): the sidebar's docking model — 1280 px starts expanded, the expand/collapse button is the one control, and Recent lists this app's items

Clause-②: no
Metadata-protocol: none

- **Which state a window starts in.** From 768 px up, a browser with no choice kept starts with the sidebar expanded on a window 1280 px wide and up, and collapsed from 768 to 1279 px. The threshold was 1416 px, and below it the sidebar folded on its own. `CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH` is now 1280 (one constant).
- **The reader's choice wins, on each side.** The sidebar's collapse button and, while it is collapsed, the page header's expand button are the one control, and this browser keeps each press: a wide-window choice and a narrow-window choice, kept apart as before. The expand button now docks the sidebar beside the page; before, it floated the menu over the page. Resting the pointer on the window's left edge and ⌘B still float the menu over a collapsed sidebar without changing the choice. Phone widths are unchanged, and the sidebar stays 256 px wide.
- **"Keep sidebar open" is gone.** Its stored choice (the workspace preference `console.sidebar.keepOpen`) is now the narrow-window choice, so a reader who kept the sidebar open starts expanded on a narrow window. Nothing to migrate.
- **Upgrade change.** On a 1280 to 1415 px window, a reader who never kept the sidebar open now starts with it expanded (it folded before), unless they collapsed it on a wide window. The accepted cost: on a 1280 px window with the sidebar expanded, the list beside an open record drawer is 304 px wide (560 before), and on 1280 to 1415 px, opening the record page's comment panel moves its fields back to the tab row; collapsing the sidebar gives the width back.
- **Recent is this app's.** From 768 px up, the sidebar's Recent group lists only the items opened in the current app. Home's "Recently accessed" and the phone drawer still list every app's.

`@object-ui/i18n`: the `sidebar.keepOpen` key, which no surface reads any more, is dropped from all eleven packs (zh-Hant regenerated).
10 changes: 8 additions & 2 deletions docs/qa/platform-checklist/areas/platform-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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 <main>, 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 <main>, no 'no actions configured' placeholder",
"Setup detail: confirm each settings URL entry (nav_settings_* → /apps/setup/system/settings/<namespace>) 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/<pkg>/<pillar> 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",
Expand Down Expand Up @@ -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"
}
]
},
Expand Down
42 changes: 20 additions & 22 deletions examples/app-showcase/e2e/detail-shapes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.

/**
* useResponsiveSidebar — the sidebar folds to its icon rail on a window
* narrower than `CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH` and unfolds when it widens
* (objectstack#27593). The wide window's open state survives the fold, a
* reader's "keep open" turns the fold off, and the phone drawer is left alone.
* Only an open or close on a wide window is kept as the wide-window choice
* (objectstack#28079).
* useResponsiveSidebar — a window starts in the reader's choice for its side
* of `CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH` (1280 px), else expanded on a wide
* window and collapsed on a narrow one (objectstack#27593, ruling 7069868269
* on objectstack#36112). The two choices are kept apart: 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 phone drawer
* is left alone.
*/

import '@testing-library/jest-dom/vitest';
Expand All @@ -15,10 +16,10 @@ import { SidebarProvider, useSidebar } from '@object-ui/components';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { useResponsiveSidebar } from '../useResponsiveSidebar';
import {
CONSOLE_SIDEBAR_KEEP_OPEN_PREFERENCE,
CONSOLE_SIDEBAR_NARROW_OPEN_PREFERENCE,
readWideWindowOpen,
} from '../../layout/consoleSidebarRail';
import { writeWorkspacePreference } from '../../utils/workspacePreference';
import { readWorkspacePreference, writeWorkspacePreference } from '../../utils/workspacePreference';

/**
* Size the test window: happy-dom's own viewport, so `innerWidth`, the
Expand Down Expand Up @@ -78,73 +79,76 @@ afterEach(() => {
document.cookie = 'sidebar_state=; path=/; max-age=0';
});

describe('useResponsiveSidebar (objectstack#27593)', () => {
it('folds the sidebar on a 1280 px window and leaves it open on a 1440 px one', () => {
renderAt(1280);
const narrowChoice = () => readWorkspacePreference(CONSOLE_SIDEBAR_NARROW_OPEN_PREFERENCE, 'user');

describe('useResponsiveSidebar (objectstack#27593, objectstack#36112)', () => {
it('starts collapsed on a 1279 px window and expanded on a 1280 px one', () => {
renderAt(1279);
expect(openState()).toBe('false');
cleanup();

renderAt(1440);
renderAt(1280);
expect(openState()).toBe('true');
});

it('keeps a manual expand on a narrow window (the rail expanded over the content)', () => {
renderAt(970);
expect(openState()).toBe('false');

fireEvent.click(screen.getByRole('button', { name: 'Expand sidebar' }));
expect(openState()).toBe('true');
it('a state it gives a window is not a choice: nothing is kept until the reader toggles', () => {
renderAt(1440);
resizeTo(1024);
resizeTo(1440);
expect(readWideWindowOpen()).toBeUndefined();
expect(narrowChoice()).toBeUndefined();
});

it('hands the wide state back when the window widens, and folds again when it narrows', () => {
it('hands each side its own state as the window crosses the threshold', () => {
renderAt(1440);
expect(openState()).toBe('true');

resizeTo(1280);
resizeTo(1279);
expect(openState()).toBe('false');
expect(readWideWindowOpen()).toBe(true);

resizeTo(1440);
resizeTo(1280);
expect(openState()).toBe('true');
expect(readWideWindowOpen()).toBe(true);
});

it('hands back a collapsed wide state as collapsed', () => {
it('keeps a collapse on a wide window, and gives it back when the window widens again', () => {
renderAt(1440);
fireEvent.click(screen.getByRole('button', { name: 'Toggle sidebar' }));
expect(openState()).toBe('false');
expect(readWideWindowOpen()).toBe(false);

resizeTo(1280);
// The reader expands the rail over the content on the narrow window…
fireEvent.click(screen.getByRole('button', { name: 'Expand sidebar' }));
expect(openState()).toBe('true');

// …and the wide window gets back the state the reader left it in.
resizeTo(1024);
expect(openState()).toBe('false');
resizeTo(1440);
expect(openState()).toBe('false');
});

it('a load that opens wide after a narrow one gets the wide state back, not the fold', () => {
renderAt(1280);
expect(openState()).toBe('false');
cleanup();

// The primitive's cookie recorded the fold; the wide-window choice is kept apart.
renderAt(1440);
it('keeps a collapse of the docked sidebar on a narrow window as the narrow-window choice', () => {
writeWorkspacePreference(CONSOLE_SIDEBAR_NARROW_OPEN_PREFERENCE, 'user', 'on');
renderAt(1024);
expect(openState()).toBe('true');
expect(readWideWindowOpen()).toBe(true);

fireEvent.click(screen.getByRole('button', { name: 'Toggle sidebar' }));
expect(openState()).toBe('false');
expect(narrowChoice()).toBe('off');
// The wide-window choice is not touched.
expect(readWideWindowOpen()).toBeUndefined();
});

it('"keep open" turns the fold off: a narrow window keeps the sidebar open', () => {
writeWorkspacePreference(CONSOLE_SIDEBAR_KEEP_OPEN_PREFERENCE, 'user', 'on');
renderAt(1280);
it('a narrow-window choice turned collapsed elsewhere collapses an open sidebar', () => {
writeWorkspacePreference(CONSOLE_SIDEBAR_NARROW_OPEN_PREFERENCE, 'user', 'on');
renderAt(1024);
expect(openState()).toBe('true');
expect(readWideWindowOpen()).toBeUndefined();

act(() => {
writeWorkspacePreference(CONSOLE_SIDEBAR_NARROW_OPEN_PREFERENCE, 'user', 'off');
});
expect(openState()).toBe('false');
});

it('leaves the open state alone below the phone breakpoint, where the drawer takes over', () => {
renderAt(700);
expect(openState()).toBe('true');
expect(readWideWindowOpen()).toBeUndefined();
expect(narrowChoice()).toBeUndefined();
});
});
Loading
Loading