Skip to content

fix(plugin-form): the grouped dialog section bar is a jump bar, hidden when the sections fit - #35988

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-35472-create-form-group-tabs
Nov 21, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-35472-create-form-group-tabs

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #35472
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到的变化:分组新建/编辑弹窗里分组名那一行改成"跳转链接"样式(带井号的胶囊),不再像标签页;所有分组都放得下时这一行不再出现;点击后表单滚到该分组并短暂高亮分组标题。
  • 为什么做:外部客户演示时反馈"切不了标签页"——那一行其实是滚动跳转,内容放得下时点了毫无反应,看起来像坏掉的标签页。
  • 出错会怎样:只影响分组弹窗与整页表单上方的跳转条;作者明确配置的标签页布局和记录详情页不受影响;可直接撤回本次合并。
  • 要你做的:无。

What changes

Which row it is (A1). The row is not the tabbed content layout. With no authored form view, the console's layout resolver returns no contentLayout (only a tabbed form view maps to 'tabbed'), so ModalForm takes the stacked arm: each group becomes a section-divider heading in one form, and the form renderer reports the drawn headings into FormSectionNavContext. ModalForm draws FormSectionNav from that report between the header and the scrolling body whenever two or more headings are reported. That component is a scroll-anchor jump bar (its own docblock: "A click scrolls to the section"; the 35092 fix made the jump scroll only the form's scroller). It was styled as underlined tabs, and when every group fit the body the jump had nothing to scroll, so only the highlight moved.

Choice: (a), a jump bar made honest. The derived default is meant to stack every group (the stacked arm, the scroll spy, the error counts per section, the collapse of a trailing group); the tab strip with mounted panels already exists for an authored tabbed layout and is untouched. So:

  • FormSectionNav is drawn as jump links: a # glyph and a rounded pill per entry, the current one filled, instead of underlined tabs on a baseline.
  • It is hidden while every section fits its scroller (scrollHeight not above clientHeight), re-read through a ResizeObserver on the form's field grid and the scroller plus window resize, so it comes back when a section unfolds or the window shrinks. An unmeasured box (height 0) is never judged to fit. The fit is read in a layout effect, so a fitting dialog never paints the bar first.
  • A click marks the heading it jumped to with data-section-jumped for JUMP_MARK_MS (1.6 s); the heading row in form.tsx styles that attribute (primary underline, tinted band, fading). A jump to a heading already in view therefore still shows where it went.
  • ModalForm takes the header's separator decision from the bar (onDrawnChange), so a fitting dialog keeps its header line.
  • The same component serves the full-page ObjectForm bar, so the same rules apply there.

Unchanged: the authored tabbed layout (renderer-owned fieldTabs, panels force-mounted), the record detail page (it renders plugin-detail sections and never mounts FormSectionNav or the form SectionDivider), collapsed groups, the scroll spy and the error counts.

Tests

ui/packages/plugin-form/src/FormSectionNav.test.tsx, a new top-level describe in the shared harness, with a recording ResizeObserver stub (the test DOM does no layout):

  • fixture scroller: no bar while two sections fit a 600 box, the bar once the content grows to 1400, gone again at 600;
  • fixture scroller: a click marks the heading it jumped to, one already in view included; a second click moves the mark; the mark clears after JUMP_MARK_MS;
  • CONTROL: a trailing collapsed section stays folded until its own entry is clicked, then unfolds and is marked;
  • record dialog: every section fits the body: no bar, the header gets its border-b back, all four headings still drawn;
  • record dialog: the sections overflow: the bar is drawn, a click scrolls the form scroller by the expected distance and marks the heading;
  • CONTROL: an authored tabbed dialog keeps its tab strip, a tab press switches the active panel, no bar.

ui/e2e/form-section-nav-dialog-scroll-35092.spec.ts: only the harness class list is updated for the bar's new classes (the spec compiles Tailwind for the classes it names).

Acceptance notes

  • The full-page form gets the same fit rule; it was not measured in a browser (the card's browser reading is the dialog).
  • The mark is an attribute the bar sets on the heading element directly; React does not manage that attribute, so a re-render leaves it alone and the timer clears it.
  • No new i18n key: the bar's visible text is the section labels it already had.
  • Browser readings were taken against the Console's Vite dev server (source), not a console:build dist.

Browser reading (A4)

Headless Chromium, 1280x900, deviceScaleFactor 2, showcase app, own backend on a random port with --fresh, Console Vite dev server pointed at it. The "before" leg swapped the three changed source files back to their origin/main blobs (hash-checked) and restored them (git diff HEAD empty afterwards). Screenshots: /mnt/project-files/objectstack-seat5/area-ux/ux-2/a4-35472/.

Object Tree Bar Click on last entry Scroller scrollTop Heading marked
showcase_category (2 groups, no authored form) origin/main drawn as tabs highlight moved to Display 0 -> 0 (scrollHeight 290 = clientHeight 290) n/a
showcase_category this PR not drawn; header keeps its separator n/a 0 n/a
showcase_account (4 groups) origin/main drawn as tabs highlight moved to Other 0 -> 165 no
showcase_account this PR drawn as jump pills highlight moved to Other 0 -> 166 yes

The origin/main category reading is the card's defect: a tab-looking row whose click changes only the highlight because the body has nothing to scroll.

Verification

All readings on head 2183374f unless stated.

Unit: 5 affected files, 50/50
pnpm exec vitest run --maxWorkers=2 FormSectionNav.test.tsx modalMaximize-34604.test.tsx modalFieldGroups.test.tsx fieldGroupSections.test.tsx form-section-nav-34605.test.tsx
 Test Files  5 passed (5)
      Tests  50 passed (50)
os-verify-lock: VERDICT command-exit 0
Red on origin/main (A2): new pins against the base blobs of the three source files, 5 red
x draws no bar while the sections fit the scroller, and draws it once they outgrow it
x a click marks the heading it jumped to for a moment, even one already in view
x CONTROL: a trailing collapsed section stays folded until its own entry is clicked, then unfolds and is marked
x draws no bar when every section fits the body, and the header keeps its own separator
x draws the bar when the sections overflow the body, and a click scrolls and marks the section
 Tests  5 failed | 15 passed (20)

The collapsed CONTROL is red on main only for its mark assertion (the fold half holds); the tabbed CONTROL is green on both trees. Restored: git diff HEAD empty.

Ablation: the fit gate removed, 2 red, restored
node scripts/ablation-replace.mjs --file packages/plugin-form/src/FormSectionNav.tsx --anchor 'const shown = listed && !fits ? listed : null;' --replacement 'const shown = listed;' -- pnpm exec vitest run --maxWorkers=2 packages/plugin-form/src/FormSectionNav.test.tsx
ablation-replace: ok mutation landed: anchor 1 -> 0, blob e04f623965b9 -> fc9257db73f7
x draws no bar while the sections fit the scroller, and draws it once they outgrow it
x draws no bar when every section fits the body, and the header keeps its own separator
 Tests  2 failed | 18 passed (20)
ablation-replace: ok restored: blob == HEAD (e04f623965b9) and `git diff HEAD` is empty

The test imports the component by relative path (vitest resolves @object-ui/plugin-form to src), so no build sits between mutation and run.

E2E 35092 spec: 6/6 in Chromium

Throwaway config (no webServer, Chromium from /opt/pw-browsers), deleted afterwards: 6 passed (21.3s).

Gates
  • pnpm --filter @object-ui/plugin-form run type-check, pnpm --filter @object-ui/components run type-check: exit 0 (tsconfig.test.json compiles the test file).
  • eslint on the five changed ui files: 0 errors.
  • node scripts/pm/dispatch-gates.mjs --commands: 38 derived families, all run, each exit 0 (pnpm --dir ui exec vitest run scripts/: 172 files passed, 2 skipped; check:query-options-erasure first hit a 300 s local timeout under box load, rerun exit 0); --ran reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN.

Authored by session_01Utp6CZrgaiMgTJCnswR6jQ (seat repo:objectstack#5, account os-bill).


Generated by Claude Code

@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 21, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 新建、编辑记录的弹窗里,分组名称那一排过去长得像标签页,点了却只换高亮、内容不动,用户以为坏了。
  • 现在那一排改成「# 分组名」的跳转按钮。所有分组都能一屏放下时直接不显示;内容超出时才出现,点击会滚到对应分组,并让该分组标题短暂高亮,告诉用户跳到了哪里。
  • 自己配置了标签页布局的表单不受影响,记录详情页也不变;整页表单的分组跳转条同样遵循这个规则。
  • 席位意见:通过;检查已全绿,由区域自行合并。

席位核对

ACCEPT · head 2183374f68 · card #35472 (claim 7056667091, lease ux-2 under the seat's 「你继续处理 ux 非专题下的 p2 任务,并发3」) · K=7 · merge-tree vs origin/main clean · governed: none (0 of 6 paths) · size +309/−27 = 336, 6 files · Clause-② no, no packages/spec path → area lands · CI 45 success, 13 skipped · 2026-11-21T05:02Z

  • Diagnosis checks out. The derived modal's row is FormSectionNav, the stacked arm's scroll-anchor bar, and not fieldTabs. Choice (a) keeps the stacked design and stops the bar looking like tabs. That fits the claim's own "either it switches the content, or it does not look like tabs" premise.
  • Fit rule (contentFits). It returns scrollHeight <= clientHeight + 1 on the resolved scroller, or on the document when the scroller is the window. A box with no height never counts as fitting, so jsdom and an unlaid box keep the bar. It is re-read through a ResizeObserver on the field grid and on the scroller, plus window resize, inside a layout effect, so a fitting dialog never paints the bar. It cannot oscillate. Hiding the bar only frees height, so a form that fits with the bar shown still fits without it. Showing the bar only takes height away, so a form that overflows while the bar is hidden still overflows once it is shown.
  • The jump mark sets data-section-jumped on the heading for 1600 ms. It is cleared on the next jump and on unmount, and styled in SectionDivider by a data-attribute variant. Collapse, the scroll spy, the 800 ms click hold and the error counts are untouched.
  • ModalForm's drawsSectionNav now follows onDrawnChange, so the header separator comes back when the bar hides. Authored tabbed layouts report no sections, so they are unchanged.
  • The changeset discloses that the full-page ObjectForm bar inherits the fit rule. Both files are within the claim surface (the components form.tsx section path and the e2e test).
  • Pins: 5 of 20 red on main and green with the fix. Ablating the fit rule turns 2 red. The 35092 e2e passes 6 of 6, after its harness classes were updated for the pills.
  • Nit: onDrawnChange reports from a passive useEffect, while fits settles in a layout effect. On the first paint of a dialog that overflows, the bar is drawn while drawsSectionNav is still false, so the header separator and the bar's border can both show for one frame. A useLayoutEffect for the report would close it.
  • Note, no action: when every section is collapsed and the form fits, the bar hides. Each collapsed heading in the form is itself the unfold control, so nothing becomes unreachable.

No required item at L1. Flip ready and land.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Landing · area ux-2 · 2026-11-21T05:03Z

reading value
L1-a ACCEPT comment 7057647921 at 2183374f68 (= current head); no required item; the one-frame separator nit carries no push
Seat no L2 owed (no packages/spec path, Clause-② no)
CI green at 2183374f68 (45 success, 13 skipped, 0 failed); K = 7 (< 15); merge-tree vs origin/main clean
check-governed-merges --pr 35988 NOT governed (0 of 6 paths); +309 / −27 ≤ 3000

State: draft → ready + auto-merge (merge queue). Fixes #35472.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 21, 2026 05:03
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 98b3f87 Nov 21, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35472-create-form-group-tabs branch November 21, 2026 05:25
github-merge-queue Bot pushed a commit that referenced this pull request Nov 21, 2026
…ts field group (#36009)

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuFchBCV6Umg5wxjoKhT7QkV)_

repo:objectstack#1 · os-sales · session_01L6bhgXUMw7b8gUmNsyoXHR

Fixes #35889

Slice S2 of #35889 (S1 = #35921, merged as f3c9d42). Claim 7057842463.
Area b1-R2.

## 维护者速读

- **用户看到的变化**:主对象的字段分组指定了主从子表(例如报销单的「Expense
Lines」分组排在「Report」和「Totals」之间)时,新建和编辑表单里这张明细表现在就出现在这个分组的位置,和记录页一致;以前(S1)它总是排在所有字段的最下面。
- **分组导航条**:表单顶部按分组跳转的导航条,现在也在明细表这一站停(例如 Report / Expense Lines /
Totals)。
-
**分页签表单**:明细表在分组的位置单独成一个页签,页签名用分组的名字。**向导表单**:主从向导本来就按简单表单画,跟简单表单一样放到分组位置。
- **不变的**:没有分组指定的子表(表单视图自己写的 subforms)、以及 sections
跟字段分组对不上的表单,明细表照旧在最下面;主记录和明细一次保存、合计在表单底部、展开一行的编辑框跟着明细表走。不改任何元数据写法。
- 本 PR 收尾 #35889(`Fixes`)。

## What changes

A master-detail collection that a field group of the parent places
(`fieldGroups[].relatedList`) is now drawn at that group in the parent's
create and edit forms, where the record page draws it, instead of below
every field of the record.

- **Form slots** (`ui/packages/plugin-form/src/formSlots.ts`, new).
`MasterDetailForm` hands its header `ObjectForm` a runtime-only list of
its collections (package-local hand-off type, not on the
`ObjectFormSchema` authoring face). `placeFormSlots` lays them out among
the form's sections by the record page's rule (`bodyTablePlacement`):
after the sections of the groups declared before the placing group,
before those declared after it; a section that names no declared group
(the ungrouped bucket) counts as after every group. A layout none of
whose sections names a declared group places nothing.
- **Simple form** (`ObjectForm.tsx`): each placed collection becomes a
`form-slot` row in the one field list, between the sections. The form
renderer (`ui/packages/components/src/renderers/form/form.tsx`) draws
that row as an empty full-width element; no new export.
- **The slot's controls are not the header form's**: the slot element
sits inside the header's `<form>`, so `FormSlotPlacement` wraps the
portaled collection in a form of its own (`noValidate`, a disabled
hidden default button, submit prevented). The header's `requestSubmit()`
then validates only its own fields (a line cell's bad input never blocks
Save with a browser bubble), a line button without a `type` (the shared
`Button` sets none) never submits the header, and Enter in a line cell
submits nothing: the lines behave as they did below the form, owned by
no header form. The renderer's reveal of an errored field
(`fieldWrapper`) skips what a host drew into this form's slot rows,
while an editor inside a slot still finds its own fields.
- **Section bar**: a slot row carries its group's (translated) label,
once per group, and the form renderer reports a labelled slot to the
host's section navigation (`FormSectionNavContext`, #34605) between the
headings around it, with the slot element as its anchor. An unlabelled
slot is no stop.
- **Tabbed form** (`TabbedForm.tsx`): a placed collection is a tab of
its own at its group's position, labelled with the group's (translated)
label. A master-detail wizard is already drawn as the simple form
(`ObjectForm`'s master-detail route), so it places the same way.
- **The collection is drawn by `MasterDetailForm`** into the slot
through a portal (`FormSlotPlacement`, a `FormSlotStore` per form in a
ref), so the lines stay out of the header's React tree: a header
keystroke still never re-renders them and they never re-render the
header. The header reports which collections its drawn layout claims
(never while it is loading), so a collection no layout claims stays in
its old place below the fields, and a remounting header (after a create)
does not make the lines jump below and back. An expanded row's editor
opens in the same slot, beside its collection. The header scrape for the
lines' `parent.*` rules skips the slot's inputs. The document totals
stay at the foot of the form.
- **Texts S1 left** ("below the record's fields until the form places it
at the group"): `ObjectFieldGroupSchema.relatedList` describe and jsdoc,
`FieldSchema.relatedList` jsdoc, the `related-list-body-table.ts` header
and its describe pin, the regenerated
`content/docs/references/data/object.mdx`, the acceptance line of
migration entry `semantic/18.master-detail-related-list-tab-by-default`,
and S1's changeset line. **ADR-0035**: one add-only note after the third
note; S1's sentences are left as written (the note says which one it
supersedes).
- `object.form.ts`'s group help ("The parent's create and edit forms
inline the table too …") makes no position claim, so it is unchanged and
its bundles are not regenerated.

## Why

Card #35889, acceptance line 2:
「同一个对象,加一个指向这张子表的分组并排在第二位:记录页字段区的第二个分组位置出现这张表;新建、编辑表单同一位置出现;页签里仍有它。」 S1
delivered the record page half; this delivers the form half, as agreed
in the split.

## Verification

Head 97afed5: main merged in after #35984 landed (three keep-both
hunks in `MasterDetailForm.tsx`, nothing else). The reviews below were
read at 84dc199. On the merged tree, `tsc` in plugin-form is clean and
the plugin-form + form-renderer suites pass (332 files, 3354 passed / 18
skipped).

- **Form ownership (L1-c should-fix)**: a DOM pin asserts every control
in the slot has a form other than the header's and clicking each line
button fires no header `submit` (red without the wrapper);
`form-invalid-scroll.test.tsx` pins that the reveal of an errored field
lands on the form's own field, not a same-named field drawn into a slot
(red without the filter). Real browser (`owner-check.cjs`): 12 slot
controls, 0 owned by the header; Enter in a cell and Add line make no
header submit and no write; with letters in a line's Amount cell
(`validity.badInput`), Create reaches the app's own check ("Amount is
required", bad cells marked) with no browser bubble. Suites after the
fix: 331 files, 3343 passed / 18 skipped; `tsc` clean in plugin-form and
components.
- **New pins (13)**: `formSlots.test.ts` (placement order, a group
declared last, entry reading, nothing placed, slot store),
`MasterDetailForm.groupPlacement-35889.test.tsx` (simple form between
the groups around its group, an unplaced collection below the form,
placed last, edit mode with loaded lines at the group and drawn once,
save batch, tabbed form tab order with the collection in its tab), and
one case in `form-section-nav-34605.test.tsx` (a labelled slot is a
section-bar stop between the headings, an unlabelled one is not).
- **Ablation**: dropping the placement (the header claims nothing) turns
4 of the DOM pins red; dropping the slot from the section-bar report
turns the nav pin red. Restored, green.
- **Suites**: `vitest run packages/plugin-form
packages/components/src/renderers/form` 331 files, 3335 passed / 18
skipped; after merging main, `FormSectionNav` (#35988) + `ModalForm` +
the new pins 8 files / 63 passed. `packages/spec` tests green;
`check:generated` clean after the object.mdx regeneration.
- **Static**: `tsc --noEmit` clean in plugin-form and components; eslint
on the changed files 0 errors.
- **Browser** (real Console on the showcase expense report, New form;
light and dark at 1280 px, light at 375 px):
- default form: Report section, then the Expense Lines grid inside the
form;
- with a temporary, uncommitted Totals field: Report, Expense Lines,
Totals in that order, and the section bar reads Report / Expense Lines /
Totals;
- temporary tabbed form view: tabs Report / Expense Lines / Totals, the
grid in the Expense Lines tab;
  - temporary wizard form view: drawn as the simple form, same order.
  All temporary edits were reverted before commit.

Clause-②: no
Metadata-protocol: none

## DELIBERATE CORRECTION (pending release note)

`Check Changeset` is red by design: this PR rewrites one line of a
pending release note it did not add, because the behaviour that line
describes is the behaviour this PR changes. Restoring it would republish
a false sentence.

- Note: `.changeset/35889-master-detail-tab-by-default.md` (S1, #35921,
unreleased).
- Before: "In the entry form a placed table still sits below the
record's fields, where `inlineEdit` tables sit today. Moving it to its
group's place in the form is a follow-up."
- After: "In the entry form a placed table sits at its group's place
too: between the sections of the groups around it, or in a tab of its
own (labelled with the group) in a tabbed form. A form whose sections
name no field group keeps it below the record's fields."

No other line of that note changes. The seat confirms this through its
same-head contract-review record (landing-operations.md).

## Follow-ups (not in this PR)

- `bodyTablePlacement` (plugin-detail) and `placeFormSlots`
(plugin-form) now spell the same ordering rule twice; a shared pure
helper would need a new export (spec or a shared ui package), so it is
left as a candidate card rather than widening this PR.
- A form section that references the placing group itself (`sections: [{
group: 'lines' }]`) still resolves to nothing (the group holds no
fields); unchanged here.
- After a jump, the section bar's brief highlight
(`data-section-jumped`, #35988) styles heading rows only, so a jump to
the table scrolls to it without the flash.
- Neighbours: #35984 also edits `MasterDetailForm.tsx` (textual
conflict, whichever lands second merges); #35923 edits `docs/adr/0035`.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01L6bhgXUMw7b8gUmNsyoXHR

<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgXUMw7b8gUmNsyoXHR -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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

2 participants