Repository navigation
Commit 50bfbb8
fix(fields): a tap on a lookup picker option's preview chip selects the option (#36602)
Fixes #36479
Clause-②: no
Metadata-protocol: none
repo:objectstack#2 · os-steve · session_01ADHkmNmMEXS4EzeVz9RjvD
## 维护者速读
-
用户在关联字段的下拉选择里点选项下方预览中的记录标签(如「客户:Fabrikam」),以前会直接跳到那条记录、编辑被丢下;现在点选项任何位置都是选中该选项,手机和电脑一样。
- 记录页字段区的体验修补,替在手机上编辑关联字段的用户解决「点错就跳走」的问题。
- 出错时最坏是预览里的记录标签或邮箱、网址不再能点开(本来在选择框里也不该点开);记录页、列表里的链接不受影响,改动可直接撤回。
- 无。
## What changes
The lookup quick-picker's option preview drew each extra column through
the read cell. A reference column became a link to its record whenever
the host answers `recordHref` (on a record page, the record chip), and
that link's click handler stops propagation and calls the host's
`openRecord`, so the option row's own click never fired. An `email` /
`url` / `phone` / file column did the same with its own anchor (the
email cell's anchor also stops propagation).
`renderLookupColumnValue` is the one renderer both picker surfaces call
(the dropdown preview and the browse-all dialog table). It now carries
the picker rule the dialog applied on its own (objectui#11903, point 7):
every candidate cell renders under a host with no record destination
(`WithoutRecordLinks`), so a reference keeps its face (the chip
included) without the anchor or hover card, and a self-linking type is
drawn with the `text` face. The fix sits where the preview gets the read
cell's link; no event is swallowed anywhere.
Desktop answer the card asked for: yes, the same click navigated with a
mouse too. The defect was the link's click handler, not the pointer
type; the pin drives both `[TouchA]` and `[MouseLeft]`.
## First read (by risk)
1. `ui/packages/fields/src/widgets/lookupColumnDisplay.tsx`: the
renderer branch of `renderLookupColumnValue` (face substitution +
`WithoutRecordLinks`).
2.
`ui/packages/fields/src/widgets/LookupField.previewLinkFree-36479.test.tsx`:
the pin.
## Tests
<details><summary>Premise reproduced on main (c0eecb1 code, pin
only)</summary>
```
× [TouchA] on the chip selects the option and opens no record
× [MouseLeft] on the chip selects the option and opens no record
× draws the chip with no anchor, so the option is the one click target
× draws a self-linking column with its text face, so a tap on it selects too
AssertionError: expected "vi.fn()" to not be called at all, but actually been called 1 times (openRecord)
AssertionError: expected "vi.fn()" to be called 1 times, but got 0 times (onChange, email column)
Tests 4 failed (4)
```
</details>
<details><summary>With the fix</summary>
```
LookupField.previewLinkFree-36479.test.tsx Tests 4 passed (4)
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>Ablation (fix committed first; renderer branch
reverted with scripts/ablation-replace.mjs)</summary>
```
ablation-replace: ok mutation landed: anchor 1 -> 0, blob f2aef5e -> a27207a105b6
× [TouchA] on the chip selects the option and opens no record
× [MouseLeft] on the chip selects the option and opens no record
× draws the chip with no anchor, so the option is the one click target
× draws a self-linking column with its text face, so a tap on it selects too
Tests 4 failed (4)
ablation-replace: ok restored: blob == HEAD (f2aef5e) and `git diff HEAD` is empty
```
`@object-ui/fields` resolves to `src/` through the ui vitest alias, so
no dist rebuild was involved in either leg.
</details>
<details><summary>Package suite and type-check</summary>
At head 186d4b4:
```
pnpm exec vitest run --root ../.. --maxWorkers=2 packages/fields/ && pnpm run type-check (under os-verify-lock)
Test Files 323 passed | 1 skipped (324)
Tests 4895 passed | 7 skipped (4902)
tsc --noEmit && tsc -p tsconfig.test.json (the test program includes src/**/*.test.tsx)
os-verify-lock: VERDICT command-exit 0
```
Only `@object-ui/fields` changes, and its public surface is
byte-unchanged (no export added or removed), so no importer owes a run.
</details>
## Acceptance notes
- `RecordPickerDialog.tsx` keeps its own `SELF_LINKING_CELL_TYPES`
substitution and `WithoutRecordLinks` wrapper; with the rule now in the
shared renderer they are redundant there (idempotent, no behaviour
change). Removing them is outside this card's file surface and left in
place.
- The record page's chip face (`ReferenceChipContext`) still reaches the
preview through the popover, so a reference in an option preview draws
as an unlinked chip there and as plain text elsewhere. Unchanged here;
noted only.
## Verification
Two-minute check: `cd ui/packages/fields && pnpm exec vitest run --root
../..
packages/fields/src/widgets/LookupField.previewLinkFree-36479.test.tsx`
shows 4 passed. In the Console (not driven in a browser by this PR; the
component pin is the evidence): showcase Field Zoo record at 375 px,
inline-edit the Master-Detail field, open the picker, tap the `Account:
Fabrikam` chip in an option preview: expect the option to be selected
and no record to open.
<details><summary>Gate families derived for this diff (head
186d4b4)</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 38 families; all 38 ran locally and
exited 0 (the vitest one under os-verify-lock). `--ran` reconciliation:
`38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN` (a derived zero: every
line carries its exit code). The type-check programs CI runs over the
whole workspace (`Type Check UI` and the `lint.yml` type-check lanes)
are CI's; the package's own `type-check` above is the local reading.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmNmMEXS4EzeVz9RjvD)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 89ce4fb commit 50bfbb8
3 files changed
Lines changed: 223 additions & 2 deletions
File tree
- .changeset
- ui/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 | + | |
| 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 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
170 | 206 | | |
171 | 207 | | |
172 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
173 | 219 | | |
174 | 220 | | |
175 | 221 | | |
| |||
213 | 259 | | |
214 | 260 | | |
215 | 261 | | |
216 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
217 | 265 | | |
218 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
219 | 271 | | |
220 | 272 | | |
221 | 273 | | |
| |||
0 commit comments