Skip to content

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

Closed

Description

@sunhaolin

承 #34605(分组导航)/ 专题 #34571。hotcrm 使用中遇到,hotcrm 侧元数据无误(见文末),不在应用侧绕过。

现状

环境:hotcrm 托管环境(ObjectOS Cloud staging 上的项目,控制台构建已含 #34642 / #34848),桌面 Chrome,zh-CN。

  1. 打开 市场 › 线索 › 新建(crm_lead?form=new)。弹窗里有六个分组,导航为 联系信息 / 线索分类 / 公司信息 / 地址 / 附加信息 / 隐私;后四个默认折叠。
  2. 点导航最后一项「隐私」(该分组只有两个复选框:禁止致电、拒收邮件)。

结果:

  • 弹窗标题「新建线索」和整条分组导航消失;
  • 「隐私」分组顶到弹窗最上沿,「取消 / 创建」紧贴在它下面;
  • 按钮栏下方到弹窗下沿是一大片空白(截图里约占弹窗高度的四分之三);
  • 弹窗内没有任何办法滚回去(外层是 overflow-hidden,没有滚动条,滚轮只作用于表单区),只能关掉重开。

期望:点「隐私」后只有表单区滚动;标题、导航、按钮栏原地不动,导航高亮落在「隐私」。

原因

ui/packages/plugin-form/src/FormSectionNav.tsx:167(origin/main b85dff0):

const reveal = () =>
  document.getElementById(item.anchorId)?.scrollIntoView?.({ block: 'start', behavior: 'smooth' });

元素级 scrollIntoView 会滚动每一层可滚动祖先,包括 overflow: hidden 但内容溢出的盒子。最后一个分组很短,表单区(ModalForm.tsx 里的 flex-1 overflow-y-auto)滚到底时分组标题还到不了顶,浏览器就把剩下的距离交给上一层——弹窗内容盒(flex flex-col overflow-hidden p-0 + sm:h-auto sm:max-h-[90vh])。弹窗盒被程序滚动后,标题和导航移出可视区,页脚下方露出空白。

同一个文件第 142–144 行的注释已经为导航条自身写明了这个顾虑("an element scrollIntoView here would also move the form and cut a jump short"),跳转本身却仍在用元素级 scrollIntoView。

已实测的部分(最小复现)

照 ModalForm 的结构写的独立页面(position: fixed + translate 居中、flex-col、overflow: hidden、max-height: 90vh;标题 / 导航 / flex: 1; overflow-y: auto 表单区 / 页脚;六个分组,最后一个很短),视口高 844,点最后一项后量到:

弹窗 scrollHeight / clientHeight 点击后弹窗 scrollTop 标题相对弹窗上沿
表单区内没有绝对定位元素 758 / 758 0 1(不动)
最后一个分组里放一个 Radix Checkbox 的隐藏 input(position:absolute; opacity:0; transform:translateX(-100%)) 2517 / 758 582.5 -581(滚出视野)

第二种情况的画面与线上截图一致:分组顶到最上、页脚紧随其后、下方空白。

机制是:表单区滚动盒是 position: static,它里面的绝对定位元素以外层 fixed 的弹窗为包含块,不受表单区裁剪、也不随它滚动,于是把弹窗盒的可滚动高度撑到了「表单全文」的高度。表单里这类元素很常见:Radix Checkbox 的 BubbleInput、Radix Select 的隐藏原生 select、sr-only。

未实测的部分

  • 没有在真实控制台 DOM 上量过。 已在真实控制台上实测并确认,撑出溢出的是「隐私」分组里两个 Radix Checkbox 的隐藏 input,数据见下方评论。
  • 整页表单(ObjectForm.tsx 里 sticky top-0 的那处导航)是否有对应问题没有验证。
  • 只在 Chromium 上看过。

要做的

  1. 跳转只滚表单自己的滚动容器:用文件里已有的 scrollParentOf(heading) 找到容器后 scroller.scrollTo({ top, behavior: 'smooth' })(容器为 null 时滚窗口),不再用元素级 scrollIntoView。
  2. (可选,防御)弹窗内容盒不应该能被滚动:表单区滚动盒加 relative,让其中的绝对定位元素被它裁剪并随它滚动;或弹窗盒用 overflow: clip。这一项单独也能消掉本现象,但第 1 项才是对因。

不做的

验收

  • 新建线索弹窗点「隐私」:标题、导航、按钮栏位置不变,[role=dialog] 的 scrollTop 始终为 0,导航高亮在「隐私」。
  • 依次点每一个导航项(含默认折叠的分组)都满足上一条;放大后同样。
  • 加一条覆盖「最后一个分组比表单区矮」的用例(jsdom 没有布局,建议放 ui/e2e)。

hotcrm 侧

src/sales/views/lead.view.ts 的表单 sections 末项是普通的折叠分组,没有特殊配置:

{ name: 'privacy', label: 'Privacy', collapsible: true, collapsed: true, columns: 2,
  fields: ['do_not_call', 'email_opt_out'] }

任何「最后一个分组较短」的分组表单弹窗都会遇到,不限于线索。

Dedupe:FormSectionNav、scrollIntoView dialog、section nav dialog title disappears、表单分节导航 → 无同题未关 / 已关单(相关:#34605、#34819)。

Activity

  1. added
    bug
    domain:ui
    on Nov 18, 2026
  2. objectstack-fleet commented on Nov 18, 2026

    @objectstack-fleet
    Contributor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    First touch (R1209, 02:4xZ): p1 · domain:ui → pm:queue.

    Themes: HotCRM usable and epic #34571's console forms (the #34605 family), with a named effect, measured on the HotCRM hosted environment. In a grouped create dialog, clicking a short last group scrolls the title and the whole group nav out of the dialog. Nothing scrolls them back, because the outer box is overflow-hidden, so the user must close the dialog and lose what they typed. The cause is pinned to the element-level scrollIntoView at FormSectionNav.tsx:167. So p1.

    Not linked under #34571; the release gate is the maintainer's call.

  3. added
    pm:queue
    priority:p1
    on Nov 18, 2026
  4. sunhaolin commented on Nov 18, 2026

    @sunhaolin
    CollaboratorAuthor

    补充:真实控制台 DOM 实测(替代正文里「未实测的部分」第一条)

    环境:同一 hotcrm 托管环境,Edge 157(Chromium),视口 1702×927,zh-CN,2026-11-18。打开 市场 › 线索 › 新建,点导航「隐私」,等平滑滚动结束后量 [role=dialog]:

    点击前 点击后
    弹窗 scrollHeight / clientHeight 796 / 796 1128 / 796
    弹窗 scrollTop(overflow-y: hidden) 0 331.5
    标题上沿相对弹窗上沿 49 -282
    导航上沿相对弹窗上沿 81 -250
    按钮栏下沿到弹窗下沿 25 357
    表单区 scrollTop / 最大值 0 / 381 437 / 437

    撑出溢出的元素(实测,不再是推断):表单区(@container flex-1 overflow-y-auto …,position: static)里有 7 个 position: absolute 且 offsetParent 是弹窗的隐藏元素。位置最低的两个是「隐私」分组展开后才挂载的 Radix Checkbox BubbleInput(do_not_call、email_opt_out,position: absolute; opacity: 0; transform: translateX(-100%)),下沿在弹窗内容坐标 1129,正好等于弹窗的 scrollHeight。其余 5 个是 Radix Select 的隐藏原生 select(salutation、status、lead_source、industry、need_type)。

    所以点击前弹窗没有溢出(折叠的分组还没挂载复选框),点击展开的那一刻才出现溢出,紧接着的 scrollIntoView 就把弹窗盒滚走了——这也是为什么只在点最后几个折叠分组时出现。

    两个修法方向在同一 DOM 上临时验证过(只改内联样式 / 滚动位置,未改代码):

    • 把弹窗 scrollTop 置回 0:标题回到 49、按钮栏下沿间距回到 25,画面恢复正常 → 现象完全由弹窗盒被滚动造成。
    • 给表单区滚动盒加 position: relative:弹窗 scrollHeight 从 1128 回到 796;此时对同一锚点(form-section-…-__section_privacy)再调 scrollIntoView({ block: 'start' }),表单区滚到 437,弹窗 scrollTop 保持 0 → 「要做的」第 2 项单独即可消除现象;第 1 项(只滚表单自己的容器)仍是对因的改法。

    仍未验证:整页表单(ObjectForm.tsx 的 sticky 导航)、非 Chromium 浏览器。

  5. objectstack-fleet commented on Nov 18, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

    Claim: PM loop round 1 · area o1-B · 2026-11-18T04:56Z
    Session: session_01JQwxbYRqkDAGuse5Wqbohi
    Account: os-warren
    Branch: claude/issue-35092-section-nav-scroll
    Worktree: objectstack-issue-35092
    Domain: domain:ui
    Seat: repo:objectstack#1
    File surface: ui/packages/plugin-form/src/FormSectionNav.tsx (the jump scrolls only the form's own scroller via the file's scrollParentOf), ui/packages/plugin-form/src/ModalForm.tsx (optional defence: the form scroller gets relative), their tests, one ui/e2e spec for "the last group is shorter than the form area", root .changeset/. Not in scope (card's 不做的): the scroll-spy highlight rule (atBottom / jumpedTo) and group collapse/expand and required counts.
    Container & model: S, mode:subagent, model: TIER_DEFAULT (dispatch-gates --tier: no path-derived mandate), effort: medium
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack ui: FormSectionNav's element-level scrollIntoView also scrolls the overflow-hidden dialog box, pushing title and nav out | none (hotcrm metadata is correct, no workaround) | every user of a grouped create dialog whose last group is short, e.g. HotCRM 新建线索 → 隐私
    Thread-read: 6967589593
    Premise: holds by the card's live DOM reading (6967589593: dialog scrollTop 0 → 331.5, overflow from Radix hidden inputs, both fix legs verified in the browser); the dev re-measures on origin/main first.
    Serial constraints cleared: none in flight on these files (last touch e556e3a; overlap-check.mjs before each push)
    Pre-claim lane: ui/packages/plugin-form/** → domain:ui, area o1-B
    Pre-claim deps: no Blocked-by:; related #34605 / #34819 / #34848 are context, not deps
    Prior rulings read: card's own 不做的 list (above); no ⛔/ruling lines on the file surface; thread: 6967589593
    Lease: lease:o1-B

  6. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 18, 2026
  7. objectstack-fleet commented on Nov 18, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi
    os-dev-report

    {
      "issue": 35092,
      "status": "done",
      "branch": "claude/issue-35092-section-nav-scroll",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/35125",
      "head_sha": "fbeab193b860badfb19f69bd9c68b28ef0fa7764",
      "session": "session_01JQwxbYRqkDAGuse5Wqbohi",
      "premise_still_valid": true,
      "summary": "Premise held on origin/main 0e46840f: FormSectionNav jump was an element scrollIntoView({block:start,behavior:smooth}). The jump now scrolls only the heading own scroller (scrollParentOf; window when null) via scrollTo, keeping the heading scroll-margin-top and the scroller scroll-padding-top. Defence (card item 2) included: ModalForm form scroller gets relative; no regression found (other absolute elements in field widgets sit in their own relative wrappers, popovers are portaled). Highlight rule, folding and required counts untouched.",
      "files_changed": [
        ".changeset/35092-section-nav-dialog-scroll.md",
        "ui/e2e/form-section-nav-dialog-scroll-35092.spec.ts",
        "ui/packages/plugin-form/src/FormSectionNav.test.tsx",
        "ui/packages/plugin-form/src/FormSectionNav.tsx",
        "ui/packages/plugin-form/src/ModalForm.tsx"
      ],
      "tests": "head fbeab193. FormSectionNav.test.tsx: Test Files 1 passed, Tests 14 passed (14). Package: pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-form/ -> Test Files 237 passed (237), Tests 2667 passed, 1 skipped; lock VERDICT command-exit 0. Unit ablation (scripts/ablation-replace.mjs, jump anchor replaced by heading scrollIntoView, on the committed fix; resolution via relative import, src not dist): mutation landed blob c20957fe4a7d -> 5f94184183cd, Tests 6 failed, 8 passed; restored blob == HEAD, git diff HEAD empty. E2E (Chromium /opt/pw-browsers, throwaway local config without webServer, deleted): 6 passed (20.1s), defect leg reproduces (old jump + scroller without relative: dialog overflows and scrolls). Same ablation under e2e: only the leg new-jump-without-relative went red (5 passed, 1 failed), the expected direction; restored to HEAD blob.",
      "gates": "local: pnpm --filter @object-ui/plugin-form run type-check exit 0 (tsconfig.test.json lists FormSectionNav.test.tsx, --listFiles count 1); eslint on the 4 ui files 0 errors; dispatch-gates --commands 38 families, each run, each exit 0 (vitest run ui/scripts: 171 files passed, 2 skipped); --ran reconciliation 38 derived, 38 run, 0 unrun (ran file carried commands only, exit codes kept separately); check:changeset-fixed exit 0; overlap-check VERDICT clean. CI at report time on fbeab193: TypeScript Type Check success, Test Core success, Build & E2E UI success, Lint UI success, Type Check UI success, Live E2E UI success, Dogfood Regression Gate success, Governed Surface Queue Guard success, Check Changeset success, Lint ESLint success; Test UI 1..11/16 in_progress, Lint PM dispatch-gates in_progress.",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "line_budget": "n/a — no skills/** touched",
      "mcp_calls": "0",
      "api_writes": "2 — relay pr_create (workflow dispatch, POST /pulls draft, request fw-20261118T053924Z-93f851, read-back 6930 bytes identical); POST /repos/objectstack-ai/objectstack/issues/35092/comments (this report, post-stamped.mjs)",
      "deviations": [
        "E2E run locally with a throwaway Playwright config (no webServer console build, Chromium executablePath /opt/pw-browsers/chromium), deleted after; CI runs it under playwright.config.ts --project=chromium.",
        "PR body carries no attribution footer: the relay stored the bytes sent with nothing appended; attribution is the prose line at its end. The harness-suggested robot footer was not used (os-dev priority).",
        "test:repo (vitest repo project) not run locally: the diff touches none of its files; declared to CI."
      ],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": []
    }
  8. objectstack-fleet commented on Nov 18, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi
    os-dev-report

    {
      "issue": 35092,
      "status": "done",
      "kind": "addendum (L1 REWORK M1, comment 6970568129)",
      "branch": "claude/issue-35092-section-nav-scroll",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/35125",
      "head_sha": "f002ef0c0fd6ac703fc8de4d1e28cc4ff31d6ee6",
      "previous_head": "fbeab193b860badfb19f69bd9c68b28ef0fa7764",
      "session": "session_01JQwxbYRqkDAGuse5Wqbohi",
      "premise_still_valid": true,
      "files_changed": [
        "ui/e2e/form-section-nav-dialog-scroll-35092.spec.ts"
      ],
      "cause_measured": "Measured before the fix: a temporary probe in the harness (not committed) recorded, inside the old jump frame, the count of hidden inputs mounted and the dialog scrollHeight. The defect leg alone ran 20 times (--repeat-each=20, Chromium): 2 failed, 18 passed. Every failure read raf hiddenInputs 0, dialog scrollHeight 758 (= clientHeight), dialog scrollTop 0. Every pass read raf hiddenInputs 2, dialog scrollHeight 1064, scrollTop 306. So the L1 reading holds: oldJump called expand() from page.evaluate, outside a React event, so the unfold was not flushed before the next frame. When the frame ran first, the Privacy hidden inputs were not mounted, nothing overflowed the dialog box, and the old jump had nothing to scroll.",
      "fix": "The harness oldJump unfolds with flushSync from react-dom, then reveals in the next frame, as the real nav does inside its click handler. The frame records jumpSaw (hidden inputs mounted), and a shared helper oldJumpToPrivacy, used by both old-jump legs (defect, and positioned-scroller-alone), asserts it equals 2. If the harness race comes back, it fails with that named reason instead of a flaky scrollTop. No sleep and no retry was added.",
      "tests": "Repeat run on the new spec (throwaway config, Chromium /opt/pw-browsers, deleted after): --repeat-each=20 over all 6 legs gave 120 passed, 0 failed, 0 flaky (6.6m), 20 passes per leg; lock VERDICT command-exit 0. Ablation (scripts/ablation-replace.mjs, flushSync removed, defect leg --repeat-each=20): 1 failed, 19 passed, and the failure was the new guard message (the old jump ran before the last section unfolded), not the scrollTop assertion; restored blob == HEAD (2bdf22f1d553), git diff HEAD empty.",
      "gates": "Local: ui scripts/__tests__/e2e-type-check.test.ts 15/15 (exit 0); eslint on the spec exit 0; check:nul-bytes, check:cross-package-test-inputs and check:test-source-alias each exit 0; overlap-check VERDICT clean before the push (origin/main aef42cba merges cleanly, so no merge was needed). CI at f002ef0c: Build & E2E UI success, its job log reads 136 passed with no flaky entry; Live E2E UI success.",
      "mcp_calls": "0",
      "api_writes": "1 — POST /repos/objectstack-ai/objectstack/issues/35092/comments (this addendum, post-stamped.mjs). git push (fast-forward, no force) is not a REST write.",
      "deviations": [
        "Worktree re-created from origin/claude/issue-35092-section-nav-scroll at fbeab193; one new commit, fast-forward push, no rebase, no merge of origin/main (no conflict)."
      ],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": []
    }
  9. objectstack-fleet commented on Nov 18, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#1 · os-warren · session_01JQwxbYRqkDAGuse5Wqbohi

    Closed by merge · 2026-11-18T07:54Z

    PR #35125 merged through the queue as 3446f234f3; Fixes #35092 closed this card. Close-out by area o1-B (claim 6969497172, L1-a REWORK 6970568129 then delta ACCEPT 6972206767, landing 6972225072). pm:dispatched and lease:o1-B removed. Rounds: 2 (the second fixed a harness race in the e2e defect leg, measured 2 of 20 before and 0 of 120 after).

  10. removed
    pm:dispatched
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugdomain:uipriority:p1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions