Repository navigation
Commit 0a3ea67
fix(ui): long-text fields read label-on-top on the record page, headings one step smaller (#37901)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoAoNwrZVJoUEFfvMURpRPKJ)_
Fixes #37801
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:记录页字段区里,多行文本、Markdown、富文本、多文件这类长字段改为标签在上、正文占满整列(实测正文从 212px
宽到 336px);字段里的 Markdown/富文本标题缩小一档(一级标题 30px 变 18px)。
- 为什么做:记录页阅读样式三张卡里的第一张(不改元数据、不需新增设计记录的那一半),替制度类长正文在左栏被挤成窄条的问题解决。
- 出错会怎样:只影响记录页字段区长字段的排版与正文标题字号,不改数据和元数据;有问题可直接撤回本 PR。
- 要你做什么:无。
## What changes
- **Field list, wide fields label-on-top** (`DetailSection.tsx`,
frameless row only). A field for which the auto layout's own
`isWideDetailField` is true (`textarea`, `markdown`, `html`, `richtext`,
`grid`, or `file` / `image` with `multiple: true` on the object field)
draws its label above the value: the row becomes `flex-col` (stretched),
the label drops its `w-28 shrink-0` column. No second type list. The
predicate is asked of the enriched field (view entry merged with the
object field), so a section entry that carries no `type` still resolves
through the object field — the same type the cell renderer draws with.
Every other field keeps the label-left row. `data-detail-field`,
`data-detail-field-row`, `data-detail-field-label` and the click-to-edit
target (the value box, its `title`, the in-place editor anchor) are
unchanged. The boxed face and the mobile grouped-inset face are
untouched.
- **Document face headings one step smaller** (`richTextDisplay.tsx`).
`RICH_TEXT_DOCUMENT_CLASS` = the shared typography + `prose-h1:text-lg
prose-h2:text-base prose-h3:text-sm`. Elements stay `h1`–`h6` (the
`?section=` anchor reads them). `RICH_TEXT_CELL_FACE_CLASS` is now built
from the shared base, not from the document class, so it is
byte-identical to before (pinned). Markdown and html/richtext read the
one constant. The comment cites objectstack#36344.
- One patch changeset for `@object-ui/plugin-detail` +
`@object-ui/fields`.
## Tests
-
`ui/packages/plugin-detail/src/__tests__/DetailSection.wideFieldLabelTop-37801.test.tsx`
— on the field list: `textarea`, `markdown`, `html`, `richtext` and
multi-file rows are label-on-top (column, label first, no fixed width,
value `min-w-0 flex-1`), rows keep `data-detail-field` /
`data-detail-field-row`; `text`, `select` and single `file` keep the
label-left row; a section entry without `type` resolves through the
object field; a click on a wide value still calls `onEnterInlineEdit`
and the value keeps its `Click to edit` title; the boxed face is
unchanged.
-
`ui/packages/fields/src/__tests__/richTextDocumentHeadings-37801.test.tsx`
— document face: markdown h1–h4 are still h1–h4 under the three size
modifiers; html and richtext carry the same class string as markdown;
the cell-face class is byte-for-byte the old string; in a grid column
neither pipeline draws a heading element or a size modifier.
- Ablation (committed fix, `scripts/ablation-replace.mjs`, restore
proven by blob == HEAD and empty `git diff HEAD`): forcing `labelOnTop`
false reds 6 of 9 in the plugin-detail file (the five wide rows and the
no-type case); removing the three modifiers reds 2 of 6 in the fields
file (markdown sizes, class composition).
<details><summary>Readings at head 2258e16</summary>
- New pins + `markdownCellHeading-36344`: Test Files 3 passed (3), Tests
24 passed (24).
- `pnpm --dir ui exec vitest run packages/plugin-detail/
packages/fields/` plus `app-shell` `recordSectionAnchor.test.tsx` and
`RecordDetailView.citedSection-37365.test.tsx`: Test Files 760 passed, 2
skipped (762); Tests 9146 passed, 25 skipped (9171); lock VERDICT
command-exit 0.
- `type-check` for `@object-ui/plugin-detail` and `@object-ui/fields`
(both `tsc --noEmit` and `tsc -p tsconfig.test.json`, whose include is
every `src/**/*.test.tsx`): VERDICT command-exit 0.
- `dispatch-gates.mjs --commands` derived 38 families for this diff; all
38 ran locally, every one exit 0 (`pnpm --dir ui exec vitest run
scripts/`: 172 files passed, 2 skipped; 5138 tests passed). `--ran`
reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN.
- `ui` `check:new-line-citations`: 0 new citation(s).
</details>
## Acceptance notes
- The value box now spans the full column (412 px including the 6 px
hover bleed each side the editable value already had; the boxed face
uses the same bleed to sit flush with a label above). The text block
inside it measured 336 px, not 400: the field-history and copy buttons
beside the value reserve 64 px (two 24 px buttons and their gaps) even
while hidden at rest. That reservation is existing behaviour of the
value box on every face and is not in this card's surface; moving those
buttons onto the label line would give a wide field the remaining 64 px.
Noted, not filed (polish).
- `ui/packages/fields/src/index.tsx` still says, in the `inGridColumn`
prop's comment, that the record page "keeps the heading sizes": it keeps
the document face's sizes, which are now one step smaller. Outside this
card's file surface; left as is.
- `ui/AGENTS.md` #2 (docs-driven) asks for the package README and a
`content/docs/frontend/` page on a feature change; this card's surface
names neither, so no docs edit is in this PR.
- The smaller headings reach every document-face caller of the
rich-content pipelines, a readonly form field included, by design of the
card (one face, one constant).
## Verification
Browser check, showcase app (`examples/app-showcase`, own backend on a
private port with `--fresh`, Console dev server from `ui/` source
pointed at it), record `Specimen — Full` of `showcase_field_zoo` with a
long markdown policy body, viewport 1204×1007, laid-out record page
(field list in the left column, `data-detail-section-list` present).
Screenshots were taken locally; the relay carries no image upload, so
the measured values are given here.
| Reading | Before (origin/main 7ad103a) | After (2258e16) |
|---|---|---|
| Markdown row direction | row | column |
| Label box | 112 × 32 px, left | 400 × 28 px, above |
| Value box width | 288 px | 412 px |
| Text block width (markdown and textarea) | 212 px | 336 px |
| Markdown row height | 1281 px | 818 px |
| h1 / h2 / h3 / body font size | 30 / 20 / 18 / 14 px | 18 / 16 / 14 /
14 px |
| Select row (control) | row, label 112 px | row, label 112 px |
| Page `scrollWidth` | 1204 | 1204 |
A click on the textarea value opened the in-place editor anchored on the
value box: anchor and popover both x 48, width 336 px.
Two-minute check: `pnpm --dir ui exec vitest run
packages/plugin-detail/src/__tests__/DetailSection.wideFieldLabelTop-37801.test.tsx
packages/fields/src/__tests__/richTextDocumentHeadings-37801.test.tsx` —
expect 15 tests passed. In the app, open any record with a markdown
field on the record page: the label sits above the body, which spans the
column, and an `# H1` in it reads at 18 px.
Read first (by risk): `ui/packages/plugin-detail/src/DetailSection.tsx`
(the `labelOnTop` branch on the row and label classes),
`ui/packages/fields/src/widgets/richTextDisplay.tsx` (the cell face now
built from the shared base, not from the document class).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibx7DSQZnugnuX8CpCM)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent d58bf7a commit 0a3ea67
8 files changed
Lines changed: 370 additions & 11 deletions
File tree
- .changeset
- content/docs/frontend/plugins
- ui/packages
- fields/src
- __tests__
- widgets
- plugin-detail
- src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
198 | 209 | | |
199 | 210 | | |
200 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
453 | | - | |
| 453 | + | |
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | | - | |
59 | | - | |
| 59 | + | |
| 60 | + | |
60 | 61 | | |
61 | | - | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
63 | 86 | | |
64 | 87 | | |
65 | 88 | | |
| |||
145 | 168 | | |
146 | 169 | | |
147 | 170 | | |
148 | | - | |
| 171 | + | |
149 | 172 | | |
150 | 173 | | |
151 | 174 | | |
| |||
185 | 208 | | |
186 | 209 | | |
187 | 210 | | |
188 | | - | |
| 211 | + | |
| 212 | + | |
189 | 213 | | |
190 | 214 | | |
191 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
908 | 908 | | |
909 | 909 | | |
910 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
911 | 920 | | |
912 | 921 | | |
913 | 922 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
971 | 971 | | |
972 | 972 | | |
973 | 973 | | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
974 | 982 | | |
975 | 983 | | |
976 | 984 | | |
977 | 985 | | |
978 | | - | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
979 | 991 | | |
980 | 992 | | |
981 | 993 | | |
| |||
992 | 1004 | | |
993 | 1005 | | |
994 | 1006 | | |
995 | | - | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
996 | 1010 | | |
997 | 1011 | | |
998 | 1012 | | |
| |||
0 commit comments