Repository navigation
Commit 6e2838c
fix(plugin-form): the master-detail dialog Save bar sits at the dialog bottom; section nav follows a scroll inside the click hold (#34848)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBU5y97XtBcJ8qSLSR3B3Djd)_
repo:objectstack#3 · os-support-ai · session_01WGufzgwLiKcfujYUug7sPs
Fixes #34819
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:带内嵌子表的新建/编辑弹窗,「取消 / 创建」按钮栏改为固定在弹窗底部(不再随滚动区上浮);分组导航在点击后的 800ms
保持期结束时再按滚动位置重算一次高亮。
- 为什么改:按钮栏原是滚动区里的 sticky
元素,停在滚动区内边距之上,滚到底还会再上移,下方留白;点完分组立刻提交校验失败时,跳回顶部的滚动落在保持期内被忽略,高亮停在原分组。
- 风险与回滚:只动 plugin-form 三个文件加一个内部 context 文件;抽屉与整页表单仍走原 sticky
路径,结构未变。回滚即 revert 本 PR。
- 先看:`ui/packages/plugin-form/src/MasterDetailForm.tsx`(根节点分 frame /
flow 两种布局的那段)、`ModalForm.tsx`(子表分支改用
`MasterDetailFrameContext`)、`FormSectionNav.tsx`(保持期结束重算与「到底时保留点击的分组」)。
- 两分钟验证:showcase 打开任一带内嵌子表对象的「新建」弹窗(如 Invoice),滚到任意位置,按钮栏下沿到弹窗下沿应恒为
25px(24px 内边距 + 1px 边框),与无子表弹窗的页脚一致。
- 需要你做的:无,席位落地。
## What changes
- **Save bar (item 1).** `ModalForm`'s master-detail arm no longer wraps
`MasterDetailForm` in an overflow scroller. It hands the form a frame
through a new package-internal context, `MasterDetailFrameContext`
(`masterDetailFrame.ts`, not re-exported from the package index; no prop
or schema key added to any exported type). With a frame,
`MasterDetailForm` lays out as a flex column: its body (header form,
line items, row editor) scrolls in its own box (`md-form-body`, the flat
arm's body gutters and `@container`), and the action bar is the
`shrink-0` row below it, outside the scrolled content, with the flat arm
footer's padding. Without a frame (the drawer, the record page) the form
renders exactly the old DOM with the sticky bar. The form still owns its
Save (ADR-0035 Decision §6); the dialog draws no footer, and the close
guard is unchanged.
- **Section navigation (item 2).** `FormSectionNav` measures once more
when the 800 ms click hold ends, so a scroll that landed inside the hold
is followed. At the very bottom of a short tail, the section the last
click picked keeps the highlight while its heading is in view (otherwise
the last section, as before); the click preference is dropped as soon as
a measure finds the form away from the bottom.
- Nav counts, the maximize button and the rest of #34599 are untouched.
## Why
Measured live (showcase on this branch's base `c513d62a`, isolated
backend plus the Console dev server, Chromium at 1280×900). Showcase has
no master-detail object whose create dialog draws two or more sections,
so for the reproduction the `showcase_invoice` header fields were given
three field groups in an uncommitted local edit (restored afterwards;
not in this diff). That dialog measured 45..855, the same box as the
card's.
- **Gap cause.** The bar was `sticky bottom-0` inside the dialog body
scroller (`py-4`). Sticky stops at the scroller's content edge, so the
bar's bottom sat 16 px (the scroller's bottom padding) plus the dialog's
own 24 px padding (`sm:p-6`, which the content's `p-0` does not override
from `sm` up) plus 1 px border above the dialog's bottom: 41 px idle;
the Create button 53 px (card: about 55). The sticky box also cannot
leave its containing block (the form root), so anything in the scroll
content past the root lifts it with the scroll: here the bar's own
`after:` strip, 8 px (41 to 49 at the end). The card's 134 px at 条款 was
not reproduced on showcase; it is the same mechanism with more content
past the form root in that form.
- **Highlight cause.** The scroll spy skips every scroll event during
the 800 ms hold a click starts, and nothing measured after the hold.
Clicking the last entry and submitting at once with the required fields
empty: the scroll back ran 13 scroll events on the body scroller, all
inside the hold, and ended at `scrollTop` 0 with the first section
marked "· 2" and the highlight still on the last section. Submitting
1200 ms after the click (the hold over) followed correctly, so the
defect is the hold window.
## Verification
**Merged head `d603500f44`.** `git merge --no-ff origin/main` at
`7752cac7` (23 commits behind) merged with no conflicts and no hand
resolution; `git show --remerge-diff d603500` is empty, and the
branch delta against origin/main is still exactly the 7 files of this
change. On the merged head, after `pnpm install --frozen-lockfile` and
rebuilding the plugin-form^... closure (turbo, 52/52): `pnpm --filter
@object-ui/plugin-form run type-check` exit 0 (0 `error TS`); `vitest
run packages/plugin-form/` Test Files 237 passed (237), Tests 2658
passed | 1 skipped (lock VERDICT command-exit 0); `overlap-check` clean
exit 0 against origin/main `d947a93cf8` and 0 PR heads. The browser
measurements below were taken on `626ff4da2a`; origin/main changed no
file under `ui/packages/plugin-form` in the merged range.
Bar bottom to dialog bottom, `showcase_invoice` create dialog (grouped
as above), idle / mid-scroll / end:
| viewport | theme | size | before | after |
|---|---|---|---|---|
| 1280×900 | light | normal (45..855) | 41 / 41 / 49 | 25 / 25 / 25 |
| 1280×900 | dark | normal (45..855) | 41 / 41 / 49 | 25 / 25 / 25 |
| 1280×900 | light | maximized (23..878) | 41 / 41 / 49 | 25 / 25 / 25 |
| 1280×900 | dark | maximized (23..878) | 41 / 41 / 49 | 25 / 25 / 25 |
| 390×844 | light | phone sheet (0..844) | 16 / 16 / 24 | 0 / 0 / 0 |
| 390×844 | dark | phone sheet (0..844) | 16 / 16 / 24 | 0 / 0 / 0 |
Reference: a dialog without a sub-table (`showcase_account` create)
measures footer bottom to dialog bottom 25 px at 1280×900 (24 px padding
+ 1 px border), so 25 is "the dialog's padding" the card asks for; at
phone width the sheet has no padding. The Create button now sits 37 px
above the dialog bottom, the same as the flat arm's.
Highlight, same dialog after the fix: click the last entry and submit at
once: highlight on the first section (was: the last). Controls: click
the second / last entry and wait 1500 ms: the highlight stays on the
clicked entry; sampled every 50 ms through a jump from the top to the
last entry (30 samples): only the clicked entry was ever highlighted.
## Tests
- `subformHosts.test.tsx`: a new top-level `describe` for #34819 pins
the dialog frame: the bar is not sticky and paints no `after:` strip, it
is the `shrink-0` row right after `md-form-body`, no element between it
and the dialog sets an overflow, the form root and the dialog frame are
`flex min-h-0 flex-1 flex-col`, one Save and no `modal-form-footer`; the
same after toggling maximize. The #34599 block keeps the drawer and page
cases (sticky), and its dialog case moved into the new block because the
structure it pinned is what this change replaces.
- `FormSectionNav.test.tsx`: a new top-level `describe` for #34819 on a
fixture scroller with set geometry: a scroll back to the top inside the
hold is followed when the hold ends; one after the hold is followed;
CONTROL: the jump does not highlight the sections it passes (samples
through the hold and after it); CONTROL: at the bottom of a short tail
the clicked section keeps the highlight when the hold ends, and a hand
scroll to the bottom still reads as the last section.
- New pins went into the components' existing harness files rather than
a card-named file, per the AGENTS.md shared-harness rule.
<details><summary>Test and ablation readings (head 626ff4d)</summary>
- `vitest run packages/plugin-form/` (whole package): Test Files 237
passed (237), Tests 2658 passed, 1 skipped; lock VERDICT command-exit 0.
- `pnpm --filter @object-ui/plugin-form run type-check`: exit 0, 0
`error TS`; `tsc -p tsconfig.test.json --listFilesOnly` lists both
edited test files.
- eslint on the six touched source and test files: 0 errors; warning
counts equal to the base per file; `masterDetailFrame.ts` clean.
- Ablation A (drop the re-measure at hold end, `ablation-replace.mjs`,
marker `ABLATION-34819-A`): 1 failed, "follows a scroll back to the top
that lands inside the click hold, once the hold ends" (expected Section
0, received Section 2); restored, blob equals HEAD, `git diff HEAD`
empty.
- Ablation B (bottom rule back to "always the last section",
`ABLATION-34819-B`): 1 failed, the short-tail CONTROL (expected Section
2, received Section 3); restored to HEAD.
- Ablation C (dialog provides no frame, `ABLATION-34819-C`): both #34819
bar pins failed; restored to HEAD.
- Ablation D (frame bar made sticky again, `ABLATION-34819-D`): both
#34819 bar pins failed (`sticky` asserted false); restored to HEAD.
</details>
<details><summary>Gates (head 626ff4d)</summary>
`node scripts/pm/dispatch-gates.mjs --commands` derived 38 families from
the 7-path change set; all 38 ran locally with exit 0 (each exit
captured before any pipe), and `--ran` reconciled 38 derived, 38 run, 0
not measured, 0 unrun. `node
scripts/check-new-cross-file-line-citations.mjs`: 0 new citations.
`overlap-check`: clean exit 0 against origin/main and 0 PR heads, before
each push. The full CI farm is CI's.
</details>
## Acceptance notes
- The record dialog's content keeps `sm:p-6` from `MobileDialogContent`
because the `p-0` the dialog passes does not override a variant class;
both arms draw inside that 24 px padding, and the header's own `sm:pt-6`
adds to it. Left as is: the card's target is the dialog's padding, which
is this value.
- In the master-detail arm the section navigation is the header form's
own strip, `sticky top-0` inside the body scroller, so content scrolls
through the scroller's 16 px top padding above it (visible in the
screenshots of both the old and the new layout). Not changed here.
- The drawer host keeps the sticky bar; it was not measured in this
change.
- The reproduction used a local field-group edit of `showcase_invoice`;
no committed example has a master-detail create dialog with two or more
sections.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzgwLiKcfujYUug7sPs)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzgwLiKcfujYUug7sPs -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent aa5a7d0 commit 6e2838c
7 files changed
Lines changed: 349 additions & 32 deletions
File tree
- .changeset
- ui/packages/plugin-form/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
81 | 88 | | |
82 | 89 | | |
83 | 90 | | |
84 | | - | |
85 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
86 | 94 | | |
87 | 95 | | |
88 | 96 | | |
| |||
101 | 109 | | |
102 | 110 | | |
103 | 111 | | |
104 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
105 | 116 | | |
| 117 | + | |
106 | 118 | | |
107 | 119 | | |
108 | 120 | | |
| |||
113 | 125 | | |
114 | 126 | | |
115 | 127 | | |
| 128 | + | |
116 | 129 | | |
117 | 130 | | |
| 131 | + | |
118 | 132 | | |
119 | 133 | | |
120 | 134 | | |
| |||
145 | 159 | | |
146 | 160 | | |
147 | 161 | | |
| 162 | + | |
148 | 163 | | |
| 164 | + | |
149 | 165 | | |
150 | 166 | | |
151 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
1780 | 1781 | | |
1781 | 1782 | | |
1782 | 1783 | | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
1783 | 1787 | | |
1784 | 1788 | | |
1785 | 1789 | | |
| |||
2179 | 2183 | | |
2180 | 2184 | | |
2181 | 2185 | | |
2182 | | - | |
2183 | | - | |
2184 | | - | |
| 2186 | + | |
| 2187 | + | |
2185 | 2188 | | |
2186 | 2189 | | |
2187 | 2190 | | |
| |||
2270 | 2273 | | |
2271 | 2274 | | |
2272 | 2275 | | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
2273 | 2289 | | |
2274 | 2290 | | |
2275 | 2291 | | |
| |||
2281 | 2297 | | |
2282 | 2298 | | |
2283 | 2299 | | |
2284 | | - | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
2285 | 2305 | | |
2286 | 2306 | | |
2287 | | - | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
2288 | 2313 | | |
2289 | 2314 | | |
2290 | 2315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
1296 | 1297 | | |
1297 | 1298 | | |
1298 | 1299 | | |
1299 | | - | |
1300 | | - | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
1301 | 1307 | | |
1302 | 1308 | | |
1303 | 1309 | | |
| |||
1320 | 1326 | | |
1321 | 1327 | | |
1322 | 1328 | | |
1323 | | - | |
1324 | | - | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
1325 | 1332 | | |
1326 | 1333 | | |
1327 | 1334 | | |
| |||
1359 | 1366 | | |
1360 | 1367 | | |
1361 | 1368 | | |
| 1369 | + | |
1362 | 1370 | | |
1363 | 1371 | | |
1364 | 1372 | | |
| |||
1467 | 1475 | | |
1468 | 1476 | | |
1469 | 1477 | | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
1470 | 1488 | | |
1471 | 1489 | | |
1472 | 1490 | | |
| |||
0 commit comments