This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit 5ab2f19
fix(fields): one record picker, one dialog layout, recomposed from the design system primitives (objectui#11903) (#11936)
Fixes #11903
Clause-②: no
The record picker (`RecordPickerDialog` in `@object-ui/fields`) is
rebuilt from the Dialog, Input, Checkbox and Table primitives
`@object-ui/components` already ships, so that it meets the card's
eight-point contract. Nothing under `packages/components/src/ui/**` is
touched. No primitive, theme token, export, prop, type member or
language-pack key is added. The ten call sites are unchanged.
## The contract, point by point, measured in a real browser
Instrument: the console preview gallery's new `record_picker` entry
(`/preview-gallery.html?only=record_picker`). It shows `multiple` mode
with three columns (name, email, email verified) over 12 in-memory
users, the shape of a related list's Add. Chromium is driven by
Playwright at 1440x900. Each reading comes from `getComputedStyle` and
`getBoundingClientRect` on the open dialog. "Before" is this branch's
gallery commit over the unchanged dialog. "After" is the fix.
| # | Point | Before | After |
|---|---|---|---|
| 1 | Header rhythm | dialog `row-gap` 0px; title bottom to search top
1px | `row-gap` 16px (the primitive's `gap-4`); title bottom to search
top 16px |
| 2 | One search border | a bordered wrapper `div` around the input; the
input still carried a ring-coloured 2px box-shadow under
`focus-visible:ring-0` (the primitive's ring offset survives it); the
dialog autofocuses the search, so two outlines showed on open |
unfocused: exactly one element with a border (the input), no ring;
focused: exactly one ring, on the input |
| 3 | Checkbox rows | header leading cell empty; a row's leading cell
empty until selected (a `Check` icon) | header: a `Checkbox` labelled
"Select all rows" that picks or clears the page; every row: a `Checkbox`
labelled "Select row" reflecting the pending selection |
| 4 | Width by columns | 1024px for three columns | 672px for three
columns (rung table below) |
| 5 | One footer bar | "12 records · Page 1 of 2" at y=696 (its own 4px
side padding) and "0 selected" at y=730: two bars, 4px out of line | one
`DialogFooter`: count line and selected count both at y=723; Cancel and
Confirm right-aligned on it; no padding of its own |
| 6 | Confirm disabled at zero | enabled with nothing picked | disabled
at zero; enabled after a pick; disabled again when it is unpicked |
| 7 | No link cells | 10 `mailto:` anchors in the visible rows | 0
anchors in the rows |
| 8 | Reviewable | none | the gallery entry above, plus the pins below |
Interaction readings after the fix, in the same gallery. A click on a
row checkbox toggles that row once. The header checkbox picks all 10
rows of the page ("10 selected"), and a second click clears them. With
the grid focused, ArrowDown ArrowDown Enter picks the second row and
Space unpicks it. Tab order from the search: the grid, the header
checkbox, the page jump, Next page, Cancel, Close. The row checkboxes
are not tab stops, so the grid's keys stay the one keyboard path.
**Point 3, the header cell.** I chose the select-all for the page. That
is the table-selection pattern the `Table` primitive is built for:
`TableHead` and `TableCell` carry `[&:has([role=checkbox])]:pr-0`. It
uses the existing `table.selectAllRows` and `table.selectRow` keys,
which exist in every pack. `pnpm check:i18n-keys` confirms the inline
defaults equal the `en` values.
**Point 4, the rung table** (`dialogWidthClass`, keyed on the drawn
column count). The last rung is the old fixed width, kept as the
ceiling:
| drawn columns | class | measured width |
|---|---|---|
| 1 to 2, single-select | `sm:max-w-xl` | 576px (1 and 2 columns) |
| 3, and every `multiple` picker with fewer | `sm:max-w-2xl` | 672px (3
columns; 1 column `multiple`) |
| 4 | `sm:max-w-3xl` | 768px |
| 5 | `sm:max-w-3xl lg:max-w-4xl` | 896px |
| 6 and more | `sm:max-w-3xl lg:max-w-5xl` | 1024px |
`multiple` mode starts at the three-column rung because of a
measurement. At the one-column rung (576px) its footer bar (count, page
controls, selected count, Cancel, Confirm) wrapped to two lines. At
672px it holds one line. The bar still wraps rather than overflows where
a longer locale or a phone needs it. At 390px wide the footer stacks the
way every `DialogFooter` does. The other rungs were measured with
throwaway edits to the gallery's column list, each restored and proven
equal to HEAD by blob hash.
**Point 7, the mechanism.** This reuses the idea from objectui#11817,
not its module, which is internal to `@object-ui/plugin-grid`. First,
the self-linking renderer keys (`email`, `url`, `phone`, `file`,
`video`, `audio`) are drawn with the `text` face inside the picker.
Second, the built-in table renders its rows under the host with
`recordHref` and `openRecord` withheld (`WithoutRecordLinks`), so a
reference value prints its name and no anchor. The inline `LookupField`
dropdown and the `renderGrid` slot keep their own rendering, which the
card puts out of scope.
## How each earlier fix's intent survives
- objectui#5492 (one renderer for both surfaces): every cell still goes
through `renderLookupColumnValue` and carries `data-lookup-cell`. The
only change is the resolver's face for the six self-linking keys, and
both surfaces still print the same text.
`LookupField.pickerAgreement.test.tsx` passes unchanged.
- objectui#10223 (a host receives the row as it was before `$expand`):
the page select-all caches `toPredicateRecord(record, fieldsMeta)`,
exactly as a row click does.
- objectui#10373 (draw only readable columns): the width rung keys on
`readableColumns.length`, the columns actually drawn.
- objectui#10486 and objectui#10594 (display-column title, field-read
rule): `renderCellContent`'s record argument is untouched.
- objectui#10789 (a refused filter is the dialog's error state):
untouched. The record count and page controls still hide on error, and
`multiple` mode still shows Cancel and Confirm (Confirm now also
disabled at zero).
- objectui#3333, objectui#3336 and objectui#3422 (filter-panel options
and their types): the filter bar and panel markup is untouched. Only its
outer wrapper's `py-2` is gone, because that spacing was standing in for
the removed `gap-0`.
- objectui#2215 and objectui#3831 (`baseFilter` shapes), objectui#4272
(display locale), the close-time reset effect (React error 185):
untouched.
- objectui#10425 (count-label pin): the pin reads
`[data-testid="record-picker-pagination"] > span`. That span is still
the count line, now inside the one footer bar.
## Pins
(`packages/fields/src/widgets/RecordPickerDialog.layout-11903.test.tsx`,
13 cases)
One pin per DOM-checkable point, plus the census for point 7:
- point 1: `gap-4` kept, no `gap-0`, and no direct child carries
vertical margin or padding;
- point 2: among the search input and its ancestors up to the dialog,
exactly one carries a border-width utility, and it is the input; the
input keeps `focus-visible:ring-2`;
- point 3: every row's leading `Checkbox` reflects the pending
selection; a click toggles once; the header selects and clears the page;
ArrowDown, Enter and Space toggle the focused row; single-select draws
no selection column;
- point 4: the rung class for 3 columns, 1 column in each mode, and 6
columns;
- point 5: the count line, page jump, Next page, selected count, Cancel
and Confirm all live in the one footer, which is a direct child of the
dialog; the bar and its two groups carry no horizontal padding;
single-select keeps one bar without buttons;
- point 6: Confirm disabled at zero, enabled with a pick, enabled over a
held value;
- point 7: under a host that routes to records, every type
`listCellRendererTypes()` reports is drawn in one picker row, and no
anchor appears. Its control draws the same probe values outside the
picker and finds the mailto, URL, tel, download and record anchors.
## Ablations (through `ablation-replace`, each restored with the blob
equal to HEAD and `git diff HEAD` empty)
Run at `2381af5`:
- **A**: Confirm's `disabled` binding replaced by an inert attribute.
The point 6 pin went red: `Tests 1 failed | 12 passed (13)`, "Received
element is not disabled".
- **B**: the self-linking text-face substitution removed. The census
went red: `1 failed | 12 passed`, with 6 anchors received (mailto, URL,
tel and three download links).
- **C**: the host handed to the rows unchanged (`recordHref` not
withheld). The census went red: `1 failed | 12 passed`, with 3 record
anchors received (lookup, master_detail, tree).
## Verification (worktree root, final head `94eb111`)
Every run below is at `94eb111`. The heavy ones went through the shared
verify lock.
- `pnpm exec vitest run packages/fields/src/widgets/`: `Test Files 114
passed (114)`, `Tests 1068 passed (1068)`. This includes the new pin
file and the objectui#5492 agreement pin.
- `pnpm exec vitest run packages/fields/src/__tests__/` plus the nine
top-level `packages/fields/src/*.test.*` files: `Test Files 128 passed |
1 skipped (129)`, `Tests 2888 passed | 7 skipped`. Together with the
widgets run, that is all 243 test files of `@object-ui/fields`.
- Consumers of the dialog: `lookupPickerKeys-7154`,
`gridDependentValues-7165`, `ObjectGrid.linkCellNoNestedAnchor-11817`,
`countLabels.ruAr-10425`, `AssignedUsersSection` (two files),
`AccessExplainPanel`, `RelatedList.addPickerFilter` and the console's
`preview-samples-registry-resolvable`: `Test Files 9 passed (9)`, `Tests
92 passed (92)`.
- Baseline before any edit (`3683591`, the widgets dir plus those
consumers): `Test Files 118 passed (118)`, `Tests 1126 passed (1126)`.
- `pnpm --filter @object-ui/fields type-check` (`tsc --noEmit && tsc -p
tsconfig.test.json`, the second leg covers the test files; it caught and
I fixed one census typing error) and `pnpm --filter @object-ui/console
type-check`, each after building its dependency closure: exit 0.
- `pnpm exec eslint` on the three touched source files: 0 errors.
- `pnpm check:control-bytes`, `check:test-path-roots`,
`check:changeset-claims`, `check:pending-changeset-literals`,
`check:i18n-keys`, `check:new-line-citations`, `check:i18n-dead-keys`,
`check:doc-types`, `check:unreferenced-sources`,
`check:lint-rule-coverage`, `check:element-data-source-declaration`,
`check:component-surface-parity`, and `node
scripts/check-changeset-presence.mjs`: exit 0, each with its own OK or
report line.
- NOT MEASURED: `check:eager-closure`. It reads
`apps/console/dist/eager-closure.json` from a console production build
(exit 2, prerequisite missing), so CI owns it. `preview-gallery.html` is
not a build input, and the dialog adds no import the package did not
already have.
- Not run, because nothing they read changed: the i18n pack gates other
than `check:i18n-keys` and `check:i18n-dead-keys` (no pack edited), and
`check:readme-exports` (no export changed).
- The repo-wide `pnpm lint` and `pnpm test` belong to CI.
## Acceptance notes
- **The card's reproduction, re-measured.** In this repository the role
page's `AssignedUsersSection` passes no `columns`, so its picker draws
one column (Name), not three. The three-column shape with blue email
links is a related list's Add picker: plugin-detail's `RelatedList`
passes derived columns and `getCellRenderer`. Both are measured above
(one column `multiple`: 672px, one footer line). The fix serves both.
- **"The keyboard pin (objectui#7154)".**
`lookupPickerKeys-7154.test.tsx` pins the four picker METADATA keys
(`multiple`, `allowCreate`, `lookupPageSize`, `dependsOn`) reaching the
grid's inline picker. It does not pin keyboard behaviour, and it stays
green. No keyboard pin for this dialog existed, so the point 3 keyboard
case above is new.
- **Confirm disabled at zero, a consequence.** A multi-value lookup can
no longer be emptied by unticking every row in this dialog and
confirming. The field's own chip remove buttons remain the way to clear
it. The card rules point 6; this is a note, not a reopening.
- **The boolean column draws checkboxes too.** `BooleanCellRenderer`
draws a read-only check control, so an "email verified" row shows the
selection checkbox and a value checkbox side by side. In the console's
theme both are circles. The selection column is the leading one, and the
pins address it by position.
- **Two copies of the self-linking set.** `SELF_LINKING_CELL_TYPES` here
re-states `plugin-grid`'s `SELF_LINKING_RENDERER_TYPES`. Each package
has a census over `listCellRendererTypes()` that goes red on its own
surface if a new type draws an anchor. No shared home was added, because
a new export is off this claim's surface.
- `content/docs/fields/lookup.mdx` lists "visual check indicators and
confirmation flow" and "mobile-friendly width (95vw on small screens)",
both still true. It is not on this claim's surface and is unchanged.
- The gallery's new specimen component raises one more
`react-refresh/only-export-components` warning, of the kind the file's
two existing components already raise. `RecordPickerDialog.tsx` has 35
warnings before and after; there are no errors.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 45d5853 commit 5ab2f19
4 files changed
Lines changed: 860 additions & 99 deletions
File tree
- .changeset
- apps/console/src
- packages/fields/src/widgets
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 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 | + | |
187 | 312 | | |
188 | 313 | | |
189 | 314 | | |
| |||
195 | 320 | | |
196 | 321 | | |
197 | 322 | | |
198 | | - | |
| 323 | + | |
| 324 | + | |
199 | 325 | | |
200 | 326 | | |
201 | 327 | | |
| |||
226 | 352 | | |
227 | 353 | | |
228 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
229 | 361 | | |
230 | 362 | | |
231 | 363 | | |
232 | 364 | | |
233 | 365 | | |
234 | 366 | | |
235 | 367 | | |
| 368 | + | |
236 | 369 | | |
237 | 370 | | |
238 | 371 | | |
| |||
0 commit comments