Skip to content

fix(components): an authored page lays its region row out by its own width, so a narrow record drawer stacks the rail - #34924

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-34826-record-page-narrow-drawer
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-34826-record-page-narrow-drawer

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

🤖 Generated with Claude Code
https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs

Fixes #34826

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:手写记录页(带 aside/sidebar 右侧栏的 page 模板)的分栏改为按页面自身容器宽度切换,不再按浏览器视口宽度切换。
  • 为什么改:记录抽屉拖窄到 380px(视口 1280px)时,右侧栏仍保持 256px 并排,主栏被挤到 3px,右侧卡片压住页签行和字段卡片;真实抽屉在 showcase 和 CRM 商机页上都复现了。
  • 风险与回滚:只改 page.tsx 里三个区域模板的 CSS class;容器宽度 768px 以上(完整页面的常见宽度)排版与以前完全一致,768px 以下(包括默认 720px 的抽屉)右侧栏改排到主栏下面。回滚即 revert 本 PR。
  • 先看:ui/packages/components/src/renderers/layout/page.tsx(新常量 PAGE_REGION_ROW_CLASS 一段与三个模板根);ui/e2e/page-region-row-narrow-drawer-34826.spec.ts;ui/packages/components/src/__tests__/page-template-slots-12476.test.tsx 末尾的新 describe。
  • 两分钟验证:打开任一带右侧栏的手写记录页(例如 HotCRM 商机),在列表里点开记录抽屉,把抽屉左边缘拖到最窄;预期右侧卡片排到主栏下方,页签行完整、无遮挡;再拖宽或打开完整页面,右侧栏回到右边。
  • 需要你做的:无,席位落地。

What changes

RegionLayout (the default template and a page that names no template), three-column and header-sidebar-main laid the body row out with the viewport breakpoint: flex flex-col md:flex-row, rails md:shrink-0 w-full md:w-64|w-80|w-96. An authored page never measures its container (unlike the synthesized default page, which uses useRecordPageTier), so in a narrow record drawer at a desktop viewport the row stayed side by side.

Each of the three template roots is now a named Tailwind container, @container/regions. The row is flex flex-col @3xl/regions:flex-row flex-1 gap-6, and each rail is @3xl/regions:shrink-0 w-full @3xl/regions:w-64 (or w-80, w-96). @3xl is 48rem, 768 px: the same pixel value as the viewport md it replaces, now measured on the layout the row sits in. Below that the rails stack under main. The container is named, so a container nested inside a region never answers the row's query.

Not changed: the dashboard template's grid (md:grid-cols-2), the page root padding, the drawer width, and the synthesized default record page.

Tests

  • Vitest class-shape pin: a new top-level describe in page-template-slots-12476.test.tsx, which is the harness that already renders every slotted template. It checks the four rail layouts: the row carries @3xl/regions:flex-row and no viewport breakpoint, the row's parent carries @container/regions, and each rail carries w-full, @3xl/regions:WIDTH and @3xl/regions:shrink-0. It also maps authored large/medium widths. The harness now imports @object-ui/react-runtime at module top, which check:test-source-alias asks of an edited file that reaches react-page.tsx.
  • Playwright GEOMETRY spec ui/e2e/page-region-row-narrow-drawer-34826.spec.ts, in the style of the record-path narrow-drawer spec. It reads the class strings from page.tsx at run time and compiles real Tailwind for them. Cases: the defect with the old classes at 380 px (main under a quarter of the layout, last tab under the rail); 360, 380 and 720 px drawers at a 1280 px viewport (stacked, no overlap); a 1000 px drawer at a 1920 px viewport and a full page at 1280 px (rail beside main at 256 px); the full page draws exactly the same boxes as the old viewport row; a 375 px phone viewport still stacks.
  • Ablation via scripts/ablation-replace.mjs: the row class was put back to md:flex-row. 4 vitest cases went red (all four rail layouts) and 3 geometry cases went red (360/380/720). The tool then restored the file, blob equal to HEAD, git diff HEAD empty.
Premise: real record drawer, before the change (head fc5913e)

Method: a local objectstack dev on a private port for each example, plus the Console Vite dev server from this branch's ui/ source. Viewport 1280x900. The record opened in the console's overlay drawer (?recordId=), then the drawer's own resize handle was dragged with the mouse to 380 px. The showcase project page temporarily got an aside rail (record:reference_rail). A temporary CRM opportunity page mirrored HotCRM's opportunity_detail_page shape: a header region, main with page:tabs, and an aside small rail. Neither temporary edit is in this PR.

reading at 380 px showcase project CRM opportunity
row flex-direction row row
main width 3 px 3 px
aside width 256 px 256 px
tab row / aside overlap 5662 px² 5662 px²

Second check: dragging the same drawer wider after open re-laid it out (main 3 px to 391 px at 768 px, the drawer's 60vw cap). It stayed side by side at every width, because the switch read the viewport. A window resize to 900 px kept the row too (main 195 px).

After the change, same rig
  • CRM, 380 px drawer: column; main 283 px; aside 283 px, below main; overlap 0. The default 720 px drawer: column, overlap 0.
  • CRM, full page at 1280: row; main 856 px; aside 256 px. Viewport 1920, the drawer opened at 380 px (column), then dragged to 1100 px after open: row, main 723 px, aside 256 px. It re-laid out without a reload.
  • Showcase, the same shape: 380 px column, overlap 0; full page row with main 856 px and aside 256 px; 1100 px drawer row.
Commands and verdicts (head 9af0fd1)
  • pnpm --dir ui exec vitest run packages/components/ (at d1eb572): Test Files 483 passed, 1 skipped (484); Tests 4634 passed, 24 skipped. The one later commit adds a module-top import to one test file; that file re-ran 21/21 at 9af0fd1.
  • pnpm --filter @object-ui/components type-check: exit 0. pnpm --dir ui run type-check:e2e: exit 0.
  • The new e2e spec plus the record-path narrow-drawer spec, chromium, with a local no-webServer config: 14 passed.
  • node scripts/pm/dispatch-gates.mjs --commands: 38 families derived and 38 run, all exit 0. check:test-source-alias was red on the first head and is green at 9af0fd1. --ran: 38 derived, 38 run, 0 NOT-MEASURED.
  • node scripts/pm/overlap-check.mjs --branch=9af0fd133f --base=origin/main: VERDICT clean exit 0.
  • Test UI, Build and E2E UI, Lint UI and the rest are left to CI.

Acceptance notes

  • Threshold choice: @3xl (768 px) keeps the old pixel value. @md (448 px) would leave a large rail beside a main column only 40 px wide at that width. The synthesized default record page switches at 760 px (recordPageTierFor), so in the default 720 px drawer an authored page now stacks its rails, as the default page already does there. A full page whose content area is under 768 px (a viewport between 768 and about 1050 px with the expanded sidebar) now stacks where it used to squeeze.
  • Print: the region row now follows the paper's content width too. Before, it followed the print viewport's md.
  • The same viewport-only family stays in this file and its neighbours, not touched here: the dashboard template's md:grid-cols-2, the page root's p-3 md:p-4 lg:p-6, and the block-span fold in page-block-span.ts. Not measured in a narrow drawer, so no card.

A record page with an aside rail, drawn in a record drawer dragged to
380 px at a 1280 px viewport, kept the viewport md row: the rail kept
256 px, main was squeezed to 3 px and the rail's cards covered the tab
row. Each region template root is now the named container `regions`
and the row, the rail widths and the rail no-shrink switch at its
@3xl (768 px, the replaced viewport md, measured on the layout).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs
…e template-slots harness

check:test-source-alias judges an edited test file: the harness reaches
react-page.tsx's dynamic import of @object-ui/react-runtime, so it now
imports it at module top, as its sibling page tests do.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 17, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhshTXCAmv9KJXRZkB

L1 review · 2026-11-17T16:55Z

L1: ACCEPT
Head-sha: 9af0fd1

What I read at this head

Checklist

  • Shape: draft, Fixes #34826. Clause-②: no and Metadata-protocol: none appear in the body and the changeset, and match the claim.
  • Scope: page.tsx (the three region-template roots, the row and the rail width classes), the existing vitest harness page-template-slots-12476.test.tsx, one Playwright geometry spec under ui/e2e/, and a root changeset. That is exactly the claim's conditional surface. The premise was measured in a real drawer before code, as the claim and triage required: 380 px at a 1280 viewport, showcase plus a HotCRM-shaped CRM page, main 3 px, overlap 5662 px².
  • Changeset: @object-ui/components patch, the only package whose src moved. Its text matches the diff: three template roots plus the no-template path, dashboard unchanged.
  • Code: the root carries @container/regions, the row carries @3xl/regions:flex-row, and the rails carry @3xl/regions:shrink-0 / w-64|80|96. All are literal strings, so the JIT scanner sees them. Tailwind is v4 in @object-ui/components (tailwindcss ^4.x), so the container variants are core, with no plugin. Other UI code already uses @container (ApprovalDecisionPanel, PermissionMatrixEditor, ObjectFormDesigner). The container is named, so a nested @container inside a region cannot answer the row's query. main keeps flex-1 min-w-0.
  • Tests: real commands with exit codes. The vitest pin covers the four rail layouts plus the width mapping, and asserts no viewport breakpoint is left on the row or rails. The geometry spec reads the class strings from page.tsx at run time and compiles real Tailwind for them, so it cannot drift from the source. ui/playwright.config.ts has testDir: './e2e' and ignores only **/live/**, so CI's Build & E2E UI picks the spec up. The ablation turned 4 vitest and 3 geometry cases red, and was restored to blob == HEAD.
  • Docs: none made false. The RegionSchema.width describe() in packages/spec/src/ui/page.zod.ts names no breakpoint. No content/docs page states the viewport md switch for page regions.
  • UI strings: none added. Unrelated files: none.

Must-fix

None.

Should-fix

None.

Escalation to the seat

E1: a full page at a mid viewport now stacks. The claim says "a fix that changes how full-width pages lay out is reported to the seat before code". The PR's Acceptance notes disclose that a full page whose content area is under 768 px now stacks its rails where it used to squeeze main: a viewport between 768 and about 1050 px with the expanded app sidebar. The dev report's open question, ruled 16:27Z to keep @3xl, framed only the 720 px drawer. This is the same threshold applied to the same mechanism and is disclosed, so L1 does not hold the PR on it. The seat should confirm that its ruling covers the mid-viewport full page too.

Notes / nits

  • N1 (note): @container sets container-type: inline-size on the template root, so the root's inline size no longer comes from its content. This is safe wherever the root is a block in normal flow or a stretched flex item, which every measured host is (full page, drawer). A future host that draws an authored page in a shrink-to-fit box (w-fit, an unstretched inline-flex child) would collapse it. Nothing does that today.
  • N2 (note): the print path now follows the paper's content width instead of the print viewport's md. This is disclosed and is the more correct reading.
  • N3 (note): the viewport-only family left in the page renderer (dashboard md:grid-cols-2, root padding, the page-block-span.ts fold) went to the seat as epic note 20. No carrier is owed from this PR.

CI at review time

There are 58 check-runs on this sha, all completed and 0 failed. Lint UI, Type Check UI, Test UI 1–16 plus the aggregate, Build & E2E UI and Live E2E UI are all green. mergeable_state: clean.

Routing

L1 ACCEPT. No L2 is owed (Clause-② no), and the PR is not governed. The area lands it once the seat answers E1, with CI green on the landing head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzgwLiKcfujYUug7sPs

Landing · area o3-B · 2026-11-17T17:46Z

Probe Reading
L1 ACCEPT 6954865824 at 9af0fd133f; no must-fix, no should-fix. E1 (a mid-viewport full page whose content area is under 768 px now stacks its rails) was answered by seat 3 at 16:56Z: the @3xl ruling (16:27Z) covers it, the same rule as the synthesized default page. N1 (container-type would collapse under a shrink-to-fit host, and no host does that today) and N2 (print follows paper width) have no user effect, so they stay in the record under the nit-only standard. N3 is already epic note 20 on #34571.
Head move since L1 00aa27a0c734fecd003bc3788262a8951479f6de = clean git merge --no-ff origin/main (d576509, 17 commits, K was 17); git show --remerge-diff empty; PR delta still the same 4 files; origin/main touched nothing under ui/packages/components/src/renderers/layout or ui/e2e in the merged range — the ACCEPT carries over (report 6955615402)
L2 (Clause-②: no) not owed (no export of @object-ui/components changes)
Checks on head 45 success, 13 skipped, 0 failure / pending; mergeable_state: clean
check-governed-merges.mjs --pr 34924 NOT governed; 322 changed lines ≤ 3000
K (first-parent, merge-base..origin/main c6ecd1f) 6 < 15
Dev-effort / Rounds high / 1

State change: ready for review + auto-merge (merge queue). Card #34826 closes on merge via Fixes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 17:46
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 7b7272f Nov 17, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34826-record-page-narrow-drawer branch November 17, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

手写记录页在 380px 宽的容器里:页签行与右侧卡片叠在一起(先确认真实窄抽屉能否复现)

2 participants