Repository navigation
Commit 729b642
fix(plugin-grid): while selecting on a phone, a tap on a link inside a card ticks the card (#36305)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X6okWxYPWAsooBsJoAhnT1u)_
Fixes #36044
Clause-②: no
Metadata-protocol: none
repo:objectstack#4 · os-project-manager ·
session_01FEkQ5oK4fFfnLADcipbEeT
## 维护者速读
- 手机上的对象列表进入多选后,点卡片里的邮箱、电话、网址、关联记录名或「⋮」,现在都是勾选或取消这张卡片,不再打开链接;点 ×
结束多选后,同样的点击照常打开链接。电脑端表格不变。
- 属于手机端重做(列表卡片与底部浮动选择条)的后续修补,解决多选时误点开链接的问题。
- 出错时手机用户在多选状态下可能点不开卡片里的链接或勾不上卡片;改动只在界面上,撤回这个 PR 即恢复原样,不动任何数据。
- 要你做的:无。
## What changes
`ObjectGrid`'s phone card (`buildMobileCardRenderer`, plugin-grid) gets
two capture-phase handlers, so one guard at the card covers every cell
renderer instead of an edit per renderer:
- `onClickCapture`: while the card list is selecting (or on the click
that ends the long press that started the selection), a click whose
target is inside the card is cancelled (`preventDefault`, so no
`mailto:` / `tel:` / URL follows) and stopped (`stopPropagation`, so no
cell handler runs: the referenced record's `openRecord`, the image
lightbox, the copy button), and the card is toggled (`toggleCardRow`).
Unticking the last card still ends the selection, as before.
- `onPointerDownCapture`: while selecting, a pointer-down on a node
inside the card (not the card itself) is `preventDefault`ed. The row's
「⋮」 is a Radix `DropdownMenuTrigger`, which opens on pointer-down and
skips its handler when the event is already default-prevented; its click
then reaches the card's click guard and toggles the card.
- Both skip a target outside the card's DOM (a node a portal draws, such
as an open menu), which React still bubbles through the card.
Every interactive element a card can draw, and what selection mode does
with it (all swallowed; none stays live):
| Element (renderer) | Opens on | While selecting |
|---|---|---|
| email `mailto:` anchor (`EmailCellRenderer`) and its copy button |
click | toggles the card |
| phone `tel:` anchor (`PhoneCellRenderer`) and its copy button | click
| toggles the card |
| URL anchor (`UrlCellRenderer`) | click | toggles the card |
| referenced record chip (`ReferencedRecordLink`: `openRecord` / href) |
click | toggles the card |
| file link (`FileValueAffordance`), image thumbnail lightbox
(`ImageCellRenderer`) | click | toggles the card |
| the row's 「⋮」 (`RowActionMenu`, Radix trigger) | pointer-down | opens
no menu, toggles the card |
| the host's title adornment (`rowAdornment`) | click | toggles the card
|
The desktop table is not touched: the guard lives only on the phone
card.
## Tests
New top-level `describe` in the cards' existing selection harness,
`plugin-grid/src/__tests__/cardSelection-35883.test.tsx` (AGENTS.md: a
new pin for a component with a shared harness file goes into that file),
at 390 px with an email and a lookup column, a
`RelatedRecordActionsProvider` host and the row's 「⋮」:
1. In selection mode a tap on the email ticks the card and opens nothing
(`fireEvent.click` answers false: the default was cancelled); a second
tap on the same link unticks it; after 「×」 the same tap opens the link
(answers true) and ticks nothing.
2. A tap on the referenced record's chip ticks the card and calls no
`openRecord`; after 「×」 it opens the record.
3. A tap on the card's 「⋮」 (`userEvent.click`) opens no menu and ticks
the card.
4. A long press on the email starts the selection with the card ticked,
and the click that ends the press opens nothing.
5. Control, 1280 px: the table (no cards) keeps its email link and chip
live while a row is ticked.
Verification readings are in the section below.
## Acceptance notes
- Keyboard: Enter on a link inside a selecting card fires a click and
toggles the card; Enter or Space on a focused 「⋮」 still opens its menu
(Radix opens it on keydown, not on click). The card's own key is
unchanged. Not in the card's acceptance (taps); filed #36315.
- The 「⋮」 stays drawn while selecting, and a tap on it toggles the card
as the ruling says. That is the intended behaviour, not a defect: hiding
it while selecting would be a design choice the card does not make.
## Verification
All on head 2ed630f (the PR's head; base c30ce97), after building
the `@object-ui/plugin-grid` dependency closure (`pnpm
--workspace-concurrency=2 --filter "@object-ui/plugin-grid^..." build`,
VERDICT command-exit 0).
<details><summary>The new pins: green, and red on main
(ablations)</summary>
`pnpm exec vitest run
packages/plugin-grid/src/__tests__/cardSelection-35883.test.tsx` (from
`ui/`, under the shared verify lock):
- Green: `Tests 13 passed (13)` (8 existing, 5 new).
- Ablation 1, the reproduction on main: `ObjectGrid.tsx` as on c30ce97
(marker counts `onClickCapture` 1 to 0, `onPointerDownCapture` 1 to 0):
`Tests 4 failed | 9 passed (13)`. The four phone pins fail (email, chip,
the 「⋮」, the long press on the email); the desktop control and the 8
existing tests pass.
- Ablation 2, only the pointer-down guard removed
(`scripts/ablation-replace.mjs`, anchor 1 to 0, blob 4fe1c05 to
5f73c210): `Tests 1 failed | 12 passed (13)`, the 「⋮」 pin alone.
- Each leg restored with `git checkout HEAD`, proven by the file's hash
equal to the HEAD blob (4fe1c05) and an empty `git diff HEAD`; green
again after: `13 passed (13)`.
- The test imports `../ObjectGrid` from source, so no `dist/` sits
between the mutation and the run.
</details>
<details><summary>Package and gates</summary>
- `pnpm exec vitest run packages/plugin-grid/` (from `ui/`): `Test Files
300 passed (300)`, `Tests 2654 passed (2654)`, exit 0.
- `pnpm run type-check` in `ui/packages/plugin-grid` (`tsc --noEmit &&
tsc -p tsconfig.test.json`; the second project compiles the tests): exit
0.
- eslint on the two changed files: 0 errors; warnings equal to main's
`ObjectGrid.tsx` (145 both).
- `node scripts/pm/dispatch-gates.mjs --commands` derived 39 families
for this diff; all 39 run locally, each exit 0 (`pnpm --dir ui exec
vitest run scripts/`: 172 files passed, 2 skipped). `--ran`
reconciliation: "39 derived famil(ies) accounted for — 39 run, 0
NOT-MEASURED (a DERIVED zero)".
- `node scripts/pm/overlap-check.mjs
--branch=claude/issue-36044-phone-select-taps`: VERDICT clean.
- The full farm (Lint UI, Test UI and the rest) is CI's.
</details>
Two-minute check: run the first command above; expect `13 passed`. In a
browser at 390 px, on a list that shows an email column, 「⋮ More」 then
「Select」, tap an email: the card ticks and no mail app opens; tap 「×」,
tap the email again: it opens.
Read first, by risk: `ui/packages/plugin-grid/src/ObjectGrid.tsx` (the
two capture handlers on the card, `onClickCapture` and
`onPointerDownCapture`), then the new `describe` in
`cardSelection-35883.test.tsx`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5oK4fFfnLADcipbEeT)_
<!-- signed: repo:objectstack#4 · os-project-manager ·
session_01FEkQ5oK4fFfnLADcipbEeT -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 740720c commit 729b642
3 files changed
Lines changed: 199 additions & 1 deletion
File tree
- .changeset
- ui/packages/plugin-grid/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4213 | 4213 | | |
4214 | 4214 | | |
4215 | 4215 | | |
| 4216 | + | |
| 4217 | + | |
| 4218 | + | |
| 4219 | + | |
| 4220 | + | |
| 4221 | + | |
| 4222 | + | |
| 4223 | + | |
| 4224 | + | |
| 4225 | + | |
| 4226 | + | |
| 4227 | + | |
| 4228 | + | |
| 4229 | + | |
| 4230 | + | |
| 4231 | + | |
| 4232 | + | |
| 4233 | + | |
| 4234 | + | |
| 4235 | + | |
| 4236 | + | |
| 4237 | + | |
| 4238 | + | |
| 4239 | + | |
| 4240 | + | |
| 4241 | + | |
4216 | 4242 | | |
4217 | 4243 | | |
4218 | 4244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| |||
221 | 227 | | |
222 | 228 | | |
223 | 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 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
224 | 386 | | |
225 | 387 | | |
226 | 388 | | |
0 commit comments