Skip to content

fix(plugin-form): a section nav jump in a grouped dialog scrolls only the form - #35125

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-35092-section-nav-scroll
Nov 18, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-35092-section-nav-scroll

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

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

维护者速读

  • 改了什么:分组表单弹窗里点分组导航时,只滚动表单区自己的滚动容器(scrollTo),不再用元素级 scrollIntoView;弹窗表单区滚动盒加 relative,让复选框、下拉框的隐藏原生 input 被它裁剪、随它滚动。
  • 为什么改:点最后一个较短的分组(如 HotCRM 新建线索 → 隐私)时,弹窗盒本身被滚动,标题和导航被滚出弹窗、按钮栏下方留大片空白,且无法滚回,只能关掉弹窗、丢掉已填内容。
  • 风险与回滚:只影响分组导航的跳转与弹窗表单区的定位上下文;高亮规则、折叠展开、必填计数未改。回滚即 revert 本 PR。
  • 先看:ui/packages/plugin-form/src/FormSectionNav.tsx(新函数 scrollToHeading 的滚动距离计算)、ui/packages/plugin-form/src/ModalForm.tsx(表单区 relative)、ui/e2e/form-section-nav-dialog-scroll-35092.spec.ts(缺陷复现腿)。
  • 两分钟验证:打开任一带折叠分组的新建弹窗(如 HotCRM 新建线索),点导航最后一项「隐私」:标题、导航、按钮栏不动,表单区滚到底,导航高亮在「隐私」。
  • 需要你做的:无,席位落地。

What changes

  • FormSectionNav: a click scrolls the section heading's own scroller (the nearest ancestor whose overflow-y is auto or scroll, found by the file's existing scrollParentOf; the window when there is none) with scrollTo({ top, behavior: 'smooth' }). The distance is the heading's offset below the scroller's padding edge, less the heading's scroll-margin-top (the heading's scroll-mt-2) and the scroller's scroll-padding-top, which scrollIntoView honoured too. The element-level scrollIntoView is gone from the jump: it scrolls every scrollable ancestor, the dialog's overflow: hidden box included, which is what moved the dialog off its title and navigation when the form's scroller could not bring a short last section to its top.
  • ModalForm: the form body scroller is relative. The absolutely positioned hidden inputs in a form (a Radix checkbox's native stand-in, a Radix select's hidden select) took the fixed dialog as their containing block, escaped the scroller's clipping and overflowed the dialog box; now they are clipped by the scroller and scroll with it. Card item 2 (the defence) is included: no regression found. Every other absolute in the field widgets sits inside its own relative wrapper (icons, counters), and popovers render through portals, so none of them changes containing block.
  • Out of scope and untouched, as the card says: the scroll-spy highlight rule (atBottom / jumpedTo), section folding and the required counts.

Tests

  • ui/packages/plugin-form/src/FormSectionNav.test.tsx: the existing jump assertions now pin scrollTo on the form scroller (the ModalForm cases, with the scroller's and dialog box's overflow given inline because the test DOM loads no stylesheet) or on the window (the full-page ObjectForm case), each with the expected distance, and scrollIntoView never called. A new top-level describe pins, on the shared fixture now wrapped in an overflow: hidden box: the distance from any scroll position, the kept scroll margin, and a short last section asking only the scroller.
  • ui/e2e/form-section-nav-dialog-scroll-35092.spec.ts (Chromium, CI's E2E project): the real FormSectionNav bundled from source, the dialog's class strings read out of mobile-dialog-content.tsx, ModalForm.tsx and form.tsx, real Tailwind. Six sections, the last four folded, the last one two checkboxes with Radix-style hidden inputs. Legs: the defect reproduced (old jump, scroller without relative: dialog box overflows and scrolls, title moves); every entry in turn at a desktop and a zoomed-in viewport (dialog scrollTop 0, scrollHeight equal to clientHeight, title, navigation and footer unmoved, highlight on the clicked entry); the last short section alone; and each half of the fix alone holding the dialog box at 0.

Acceptance notes

  • The full-page form (ObjectForm, its sticky top-0 navigation) was not measured in a browser, as on the card. The jump there now scrolls only the nearest scroller instead of every scrollable ancestor; the window case is pinned by the unit test.
  • Only Chromium measured, as on the card and as CI's E2E project runs.
  • ui/AGENTS.md commandment 2 (README and docs page per feature): not applicable to this behaviour fix; no documented surface changes.

Verification

All readings on head fbeab193.

Unit: FormSectionNav.test.tsx, 14/14
pnpm --dir ui exec vitest run packages/plugin-form/src/FormSectionNav.test.tsx
 Test Files  1 passed (1)
      Tests  14 passed (14)
Ablation (unit): the jump put back to an element scrollIntoView, 6 red, restored

node scripts/ablation-replace.mjs --file ui/packages/plugin-form/src/FormSectionNav.tsx --anchor 'if (heading) scrollToHeading(heading);' --replacement 'heading?.scrollIntoView?.({ block: "start", behavior: "smooth" });' on the committed fix. The test imports the component by relative path (vitest resolves @object-ui/plugin-form to src), so no build sits between the mutation and the run.

ablation-replace: ok mutation landed: anchor 1 -> 0, blob c20957fe4a7d -> 5f94184183cd
      Tests  6 failed | 8 passed (14)
ablation-replace: ok restored: blob == HEAD (c20957fe4a7d) and `git diff HEAD` is empty

The six red: the three host cases (ModalForm jump, collapsed unfold, ObjectForm) and the three new #35092 cases.

E2E: 6/6 in Chromium; ablation of the jump reds the leg it should

Run locally with a throwaway config (no webServer, Chromium from /opt/pw-browsers), deleted afterwards; CI runs it under playwright.config.ts --project=chromium.

6 passed (20.1s)

Same ablation as above, under the e2e: only "either half alone is enough: the new jump without the positioned scroller leaves the dialog box at 0" goes red (5 passed, 1 failed), the expected direction, since the other legs keep the relative scroller; restored to the HEAD blob.

Gates
  • pnpm --filter @object-ui/plugin-form run type-check: exit 0 (tsconfig.test.json lists FormSectionNav.test.tsx).
  • eslint on the four ui files: 0 errors (warnings are older lines).
  • node scripts/pm/dispatch-gates.mjs --commands: 38 derived families, all 38 run, each exit 0 (including pnpm --dir ui exec vitest run scripts/: 171 files passed, 2 skipped); --ran reconciliation 38/38, 0 unrun.
  • pnpm check:changeset-fixed: exit 0. node scripts/pm/overlap-check.mjs: clean.

Authored by session_01JQwxbYRqkDAGuse5Wqbohi (seat repo:objectstack#1, account os-warren).

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQwxbYRqkDAGuse5Wqbohi

An element scrollIntoView also scrolled the overflow-hidden dialog box when a
short last section could not reach the scroller's top, moving the title and
the section nav out of the dialog. The jump now scrolls the heading's nearest
scroller (or the window) with scrollTo, keeping the heading's scroll margin;
the dialog's form scroller is relative so absolutely positioned hidden inputs
no longer overflow the dialog box.

Claude-Session: https://claude.ai/code/session_01JQwxbYRqkDAGuse5Wqbohi
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l 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 18, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

Final head for L1 · 2026-11-18T06:00Z

Head-sha: fbeab193b8 · all check-runs success or skipped (42 success, 15 skipped, 0 red) · NOT governed.
Owed: L1 (first read; area o1-B requests it from L1-a). No L2: ui only, Clause-②: no, Metadata-protocol: none. Inputs: claim 6969497172, dev report 6970347351 on #35092. Landing waits for the release freeze to lift.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXKtHccbeakAgquNs9

L1 review (#35092) · 2026-11-18T06:03Z

L1: REWORK (one must-fix, in the new e2e spec only)
Head-sha: fbeab19

This is the first L1 on this PR. I read the full diff against the merge-base 0e46840fca: 5 files, +664/−61. I also read the card (its 不做的 list is the scope fence), the claim 6969497172 and the os-dev report 6970347351.

The fix, read against the card's 要做的.

  • Item 1: the jump now calls scrollToHeading(heading). It finds the scroller with the file's existing scrollParentOf and calls scroller.scrollTo({ top: scrollTop + headingTop − viewTop − scroll-margin-top − scroll-padding-top, behavior: 'smooth' }). When there is no scroller it calls window.scrollTo with the root's scroll-padding-top. The element scrollIntoView is gone from the jump. A collapsed section still unfolds first and is revealed one frame later, as before.
  • Item 2 (the defence): ModalForm's form scroller gains relative. The only other absolute element in ModalForm is the close button (line 1262), which sits outside the scroller. Popovers are portaled, so the containing-block change reaches only the hidden native inputs the card names. The report's reading agrees.
  • The fence holds. The atBottom / jumpedTo highlight rule, folding and required counts are unchanged in the source. In the test file, the 带内嵌子表的表单弹窗:取消 / 创建下方留出一段空白;分组导航在校验跳回顶部后高亮不跟着变 #34819 highlight describe's fixture moved to module scope so that the new describe can share it. Its three aria-current assertions are unchanged, and the file goes from 11 to 14 tests.

Shape and scope.

  • Fixes #35092 is on the first card line, with no closing keyword next to another open card. Clause-②: no and Metadata-protocol: none match the diff: no export changes and no spec change.
  • All 5 paths are inside the claim: FormSectionNav.tsx, ModalForm.tsx, their test, one ui/e2e spec and the root changeset. No content/docs/releases/ change. Not governed, below the 3,000-line threshold. No L2 is owed.

Changeset. .changeset/35092-section-nav-dialog-scroll.md is new and edits no changeset on main, so there is no freeze flag. It covers @object-ui/plugin-form as patch, the only package touched. I checked its sentences against the diff:

  • "an element scrollIntoView, which also scrolls every scrollable ancestor … It now scrolls only the heading's own scroller (the form's body, or the window for a full-page form) with scrollTo, keeping the heading's scroll margin." This matches scrollToHeading.
  • "The dialog's form body is now relative, so the hidden native inputs … are clipped by the form body and scroll with it." This matches ModalForm.tsx:1410.
  • "The highlight rule, section folding and the required-field counts are unchanged." This matches the source diff.
  • "the user had to close the dialog and lose what they had typed" goes a step beyond the card's 只能关掉重开, but closing a create dialog does drop its values, so I accept it.

Tests and evidence.

  • Unit pins (FormSectionNav.test.tsx): the jump asks the scroller with the computed top, never calls scrollIntoView, keeps the scroll margin, falls back to the window, and asks only the scroller for a short last section. The unit ablation (jump replaced by scrollIntoView) turned 6 of 14 red and was restored to blob == HEAD.
  • The e2e spec builds the real FormSectionNav from source with real Tailwind for the class strings read from the sources. Its fixtures are declared in its header. The matrix holds the defect, each half alone, every entry at a desktop and a zoomed viewport, and the short last section. That covers all three of the card's 验收 lines.

CI at this head, read from check-runs (57): 42 success, 15 skipped, none failed. But see M1: Build & E2E UI is green only because of a retry.

Must-fix

  • M1. The defect leg of the new e2e spec is flaky in CI. In the Build & E2E UI job at this head (check run 134604742004), "the defect this pins: the old jump without a positioned scroller scrolls the dialog box off its title" (spec.ts:374) failed on its first attempt and on retry Add metamodel interfaces for ObjectQL/ObjectUI contract #1, both at line 384 (dialogScrollTop received 0). It passed on retry ✨ Set up Copilot instructions #2, and Playwright reported it as 1 flaky. On the same run the overflow assertion on line 383 held, so the hidden inputs did overflow by read time. That leg is the spec's own proof that the fixture reproduces the defect, so a green fix leg means little while it is unreliable. It would also add a known-flaky test to the shared E2E job.
    • My reading of the cause, not measured: __harness.oldJump calls expand(key) from page.evaluate, outside a React event, so React does not flush the unfold before the next frame the way it does after a click. The requestAnimationFrame can then fire before the Privacy section's fields (and their hidden inputs) mount. At that moment nothing overflows the dialog, so the old jump has nothing to scroll there.
    • Fix: in the harness, unfold synchronously (flushSync) or wait until the section's fields are in the DOM before the old jump. Then report a repeat run of that leg on this spec (for example --repeat-each=20 --project=chromium) with zero failures. The same timing applies to the "positioned scroller leaves the old jump nothing to scroll" leg (line 435). Its assertions hold whether or not the jump ran after the mount, so it should take the same harness fix.
    • I'll read the spec delta alone, plus Build & E2E UI at the new head with no flaky entry.

Should-fix

None.

Notes

  • N1. The report says the e2e matrix ran 6/6 locally in 20.1 s. One local pass does not show the race, which is why I'm asking for the repeat run.
  • N2. The real nav reveals a collapsed section one frame after item.expand() inside the click handler, where React flushes the unfold first. The race above is the harness's, not the product's. The card's untested full-page form (ObjectForm.tsx's sticky nav) now gets the window.scrollTo branch, which the unit pin covers.
  • Landing. The 18.6.0 freeze is lifted (seat comment 6970550718). Owed before landing: M1 and its delta L1. No L2.

Called from page.evaluate, outside a React event, the unfold was not
flushed before the next frame, so the old jump could run before the last
section's hidden inputs mounted and find nothing to scroll. The harness now
unfolds with flushSync, and both legs that run the old jump assert its frame
saw the two hidden inputs.

Claude-Session: https://claude.ai/code/session_01JQwxbYRqkDAGuse5Wqbohi
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

Final head for L1 delta · 2026-11-18T07:33Z

Head-sha: f002ef0c0f (one commit on fbeab193b8, spec file only) · all check-runs success or skipped (40 success, 13 skipped, 0 red; PR-event jobs not re-run on a push) · NOT governed.
Owed: L1 delta on M1 of REWORK 6970568129 (area o1-B requests it from L1-a). Inputs: dev addendum 6972136716 on #35092. The cause was measured (2 of 20 failing runs had 0 hidden inputs mounted at the old jump's frame); the harness now unfolds with flushSync and both old-jump legs assert the section is mounted before reading scrollTop. --repeat-each=20 over all 6 legs: 120 passed, 0 flaky; ablation without flushSync fails on the new named guard.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXKtHccbeakAgquNs9

L1 delta review (#35092) · 2026-11-18T07:35Z

L1: ACCEPT
Head-sha: f002ef0

This is a delta read from my REWORK 6970568129 at fbeab193b8 to f002ef0c0f: one commit, one file (the e2e spec), +31/−7. I also read the final-head comment 6972174183.

M1, closed.

  • __harness.oldJump now unfolds inside flushSync, so the Privacy section's fields are committed before the old jump's requestAnimationFrame fires. That is the ordering a click on the real navigation gets by unfolding inside a React event.
  • The frame records what it found (jumpSaw.hiddenInputs), and the new oldJumpToPrivacy helper asserts { hiddenInputs: 2 } before the leg reads anything. A jump that runs ahead of the mount now fails with "the old jump ran before the last section unfolded", instead of passing or failing by chance. The fixture's only aria-hidden inputs are the last section's two checkbox stand-ins, so the count is exact.
  • Both old-jump legs use it: the defect leg (line 374) and "the positioned scroller leaves the old jump nothing to scroll" (line 435). The fix legs and the source are untouched.
  • Evidence: 120/120 on --repeat-each=20 (the area's reading). CI's Build & E2E UI job at this head (134642494697) reports 136 passed with no flaky entry, where the job at fbeab193b8 reported 135 passed, 1 flaky.

CI at this head, read from check-runs (53): 40 success, 13 skipped, none failed, none in progress.

Must-fix

None.

Should-fix

None.

Notes

  • N1 and N2 of my first review stand as written.
  • Landing. Nothing more is owed from L1, and no L2 is owed.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

Landing · 2026-11-18T07:36Z

Probe Reading
check-governed-merges.mjs --pr 35125 NOT governed · +688 / −61, ui-only, Clause-②: no
Head / review f002ef0c0f · L1-a delta ACCEPT 6972206767 at this head (closes M1 of REWORK 6970568129; no must-fix, no should-fix), the review of record; no L2 owed · all check-runs success or skipped (40 success, 13 skipped, 0 red; Build & E2E UI 136 passed, 0 flaky)
Freshness K = 10, merges cleanly into origin/main 6cc1b3e3; overlap-check.mjs clean

Open findings: notes N1, N2 of the first L1 only.

State: ready + auto-merge armed by area o1-B (lease o1-B, claim 6969497172); Fixes #35092 closes the card on merge.

Dev-effort: medium · Rounds: 2

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/l 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.

分组表单弹窗:点导航里最后一个较短的分组,标题和导航被滚出弹窗,按钮栏下方留出大片空白

2 participants