You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dc10b3b
Browse filesBrowse the repository at this point in the historyBrowse files
fix(grid): in a list cell a single click only selects; no copy buttons (#36015) (#36033)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu2yMB8uuX9RDZCxYnGyuHiY)_
repo:objectstack#1 · os-sales · session_01L6bhgTQn1haiL13TBfwmxm
Refs #36015
The card's scope changed after this PR was opened (maintainer,
2026-11-21 11:13Z: lookup chips open the referenced record in the side
drawer on a single click, with a pencil button on lookup cells). This PR
lands everything the revision kept. The lookup-cell part follows in its
own PR, which carries `Fixes#36015`. Until then, a lookup chip selects
its cell on a single click and opens with Ctrl/Cmd-click, the open
button or Ctrl/Cmd+Enter.
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
列表格子里单击只做一件事:选中这一格。点邮箱、电话、网址、文件、关联记录或人员的小标签、图片缩略图,都只是选中,不再打开邮件程序、拨号、网页或跳到别的记录。
- 想打开时有三条路:按住 Ctrl / Cmd 再点;选中这一格后鼠标移上去,格子右边出现「打开」小图标,点它;或选中后按
Ctrl+Enter / Cmd+Enter。一格里有多个标签时,图标和快捷键打开第一个。
- 邮箱、电话格里的复制按钮在列表里不再出现;复制用选中后 Ctrl+C / Cmd+C。双击邮箱文字照常进入编辑。
- 名称列不变:单击名称进记录页。记录页、相关列表、手机卡片、看板卡片都不变(它们没有「先选中」的格子模型)。
- 风险:改了 data-table、字段格子渲染和名称列链接三处;没有新导出、没有新文案键(「打开」复用已有的 `table.open`)。
## What changes
The rule, on a grid with the select-first cell model
(`GridCellSelectionProvider`, mounted by `ObjectGrid` when its host
passes `cellSelection`; today the console's list page): **a single click
on a cell only selects it.**
**`@object-ui/components`: `dataTableCellSelection.ts`,
`data-table.tsx`**
- New `cellOpenerAt` / `firstCellOpener`: a cell's *opener* is any
`a[href]` it draws, except one marked `data-opens-on-click`, plus any
element marked `data-cell-opener`.
- `isCellWidgetTarget` no longer counts an opener as a widget. A press
on a link is a press on the cell, so a double-click on the email text
edits, and the double-click's word selection is suppressed as on any
cell.
- Each select-first cell gets an `onClickCapture`. A plain primary click
on an opener calls `preventDefault` (no `mailto:`, `tel:`, new tab or
download), stops the event before the opener's own handler (no SPA
navigation), and selects the cell. A Ctrl, Cmd, Shift or Alt click, a
non-primary button, a touch tap and a click inside an open editor pass
through unchanged.
- The selected cell draws `CellOpenButton`, an icon button at its right
edge labelled with the existing `table.open` key. It is shown on cell
hover (`group-hover/cell`) and drawn only while the cell holds an
opener; a `MutationObserver` catches a lookup chip that becomes a link
after its name is read. It takes no focus (`tabIndex=-1`, `mousedown`
prevented), so typing carries on in the cell. It never appears on an
unselected cell or on row hover.
- Ctrl/Cmd+Enter on the selected cell (the type catcher) opens the
cell's first opener; with no opener the key does nothing. Plain Enter
still edits.
- Opening means clicking the opener for the reader (`openCellOpener`)
while a ref tells the capture handler to let it through. Each value
keeps its own behaviour: the host's `openRecord` for a referenced
record, the browser's for `mailto:` / `tel:` / `target=_blank`, the
lightbox for an image.
- Select-first cells carry `[&_[data-cell-copy]]:hidden`, so a copy
control a value draws is not drawn there. Ctrl/Cmd+C on the selected
cell copies, as before.
**`@object-ui/fields`: `index.tsx`**
- The email and phone copy buttons carry `data-cell-copy`. These are the
only copy buttons a cell renderer draws (searched `clipboard.writeText`
and the `Copy` icon across `fields`, `plugin-grid`, `components`
renderers and `react`; the other hits are edit widgets or grid-level
hooks).
- Image thumbnails (single, stacked, and the `+N` button) carry
`data-cell-opener`.
**`@object-ui/plugin-grid`: `objectGridLinkCell.tsx`**
- The name column's record link (`RecordLink` anchor) carries
`data-opens-on-click`. It is the one link a single click still follows
(card item 5). Its span fallback (no host URL) is `role="link"`, which
stays a widget and keeps its click.
**Field types this reaches in a list cell:** email, phone, url, file /
video / audio (download link), image (thumbnail lightbox), restricted
file (lock link), lookup / master_detail / tree and every other
reference family drawn through `ReferencedRecordLink` (owner and other
user lookups included), and any custom cell renderer that draws an
`a[href]`.
**Not changed (claim readings A–C):**
- **A.** Only grids with the select-first model. Related lists, the
record page's fields, phone cards (`ObjectGrid` below 768px), kanban
cards, and every grid whose host does not pass `cellSelection` keep
their links and copy buttons byte for byte. The copy buttons are hidden
by the table, not removed by the renderer, for exactly this reason: the
phone card under the same provider still draws them.
- **B.** A cell of several chips opens the first one by the button or
Ctrl/Cmd+Enter; a Ctrl/Cmd-click opens the one clicked.
- **C.** File links and image thumbnails follow the same rule.
Docs: `content/docs/frontend/plugins/plugin-grid.mdx` § On an object's
list page (the click bullet and the selected-cell keys).
## Tests
Rewritten, because it pinned the behaviour this card reverses:
- `components/src/__tests__/data-table-select-first-35684.test.tsx`: the
describe "a link in a cell keeps its click" ("a click on the link
follows it and selects nothing; a double-click beside it edits") is
replaced by "a click on a link the cell draws only selects
(objectstack#36015)". It pins: a plain click selects and cancels the
default, Ctrl/Cmd-click follows, a double-click on the link edits, the
`data-opens-on-click` title link keeps its click (control), the open
button appears only on the selected cell and follows the link, a cell
with nothing to open hides the button, Ctrl/Cmd+Enter follows the link
while plain Enter edits, and the copy-hiding class is present only under
the provider (control without it). The fixture's link cell gained a
`data-cell-copy` button; an opt-in `withTitle` column carries the title
link.
Added:
- `plugin-grid/src/__tests__/ObjectGrid.cellSelection-35684.test.tsx`,
new describe, end to end through `ObjectGrid` with a host that routes
records: a click on the `mailto:` link and on the lookup chip selects
each cell, cancels the default and opens nothing; Ctrl+Enter and the
open button call the host's `openRecord` for the referenced record; the
title link is the only `data-opens-on-click` element and keeps its
click; the email cell draws its copy button marked `data-cell-copy`
inside a cell that hides it.
Unchanged and still green:
`ObjectGrid.linkCellNoNestedAnchor-11817.test.tsx` ("an email column
that is not the link column keeps its mailto anchor and copy button", a
grid without `cellSelection`, the control for reading A),
`cellRenderers.objectLiteral-8596.test.tsx`, `data-table-keys-35687`,
`data-table-cell-overlay-35688`, `data-table-autosave-35685`.
Local runs (`@objectstack/*` built with `OS_SKIP_DTS=1`; first on
`be91bfc2`, the data-table / ObjectGrid / fields files again after
merging `c00be39b`, which carries #36018 and #36021):
- `vitest run packages/components/ packages/fields/
packages/plugin-grid/`: 1103 files passed. The only failing file is
`share-filter-sort-spec-parity.test.ts`, which reads
`@objectstack/spec`'s `.d.ts` that a DTS-less build does not write.
- `vitest run packages/plugin-list/`: 180 files passed. The only failing
file is `spec-symbol-batch6.test.tsx`, for the same reason.
- After the merge: `vitest run packages/components/src/__tests__/` plus
`ObjectGrid.cellSelection-35684`,
`ObjectGrid.linkCellNoNestedAnchor-11817`, `selectionBar-35678` and
`inCellFaces-35688`: 289 files passed; the same parity file failed, and
`object-icon-tile-35985` failed against a stale spec build and passed
once the spec was rebuilt.
- `eslint` on the changed files: 0 errors.
- `overlap-check` on the pushed head: clean against `origin/main`, no
open PR shares a file.
## Verification (browser)
CRM example (`--fresh`), Console via Vite HMR on this tree, Chromium.
The before run used `origin/main`'s versions of the four source files.
Screenshots and journey logs: project folder `build-seat1/36015/`
(`before-*`, `after-*`).
| Step (Contacts list, 1280) | Before | After |
|:--|:--|:--|
| Hover a row | copy icon beside each email | no copy icon |
| Click the email text | `mailto:` request, cell not selected | cell
selected, navigation cancelled |
| Click the Account chip | page leaves for the account record | cell
selected, page stays |
| Selected chip cell, hover | no open button | open button at the right
edge |
| Ctrl+Enter on it | nothing | opens the account record |
| Click the name | opens the contact record | same |
| Double-click the email text | `mailto:` twice, no editor | editor
opens |
| Accounts list, click the Website link | new tab opened | cell
selected, no tab |
| 375 phone list | cards | same cards |
## Acceptance notes
1. Hover a row: no copy icon in the email or phone cell: yes (browser,
email; phone shares the same marker and class, unit-pinned through the
fixture).
2. Click the email text: the cell is selected, no mail program;
Ctrl/Cmd+C copies the address: yes (Ctrl+C path unchanged,
`String(row[col])`).
3. Phone and URL cells: same: yes (URL in the browser; phone is an
`a[href^="tel:"]`, the same opener rule).
4. Owner chip and lookup chip: selected, the page does not leave: yes
(the Account lookup chip in the browser; an owner or other user lookup
draws the same `ReferencedRecordLink` anchor, not checked in the browser
separately).
5. Ctrl/Cmd-click email opens the mail program; Ctrl/Cmd-click a chip
opens the record: yes (the click passes through untouched).
6. The open icon appears on the selected lookup cell, opens the record,
and is absent when the cell is not selected: yes.
7. Ctrl/Cmd+Enter opens: yes.
8. Click the name opens the record page as before: yes.
9. Double-click the email cell edits: yes.
10. Record page email and phone fields unchanged: yes (no select-first
model there; renderer markup only gains attributes).
11. This body lists the field types reached and the rewritten tests:
above.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgTQn1haiL13TBfwmxm)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgTQn1haiL13TBfwmxm
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgTQn1haiL13TBfwmxm -->
Co-authored-by: Claude <noreply@anthropic.com>
fix(grid): in a list cell a single click only selects, and the email and phone cells draw no copy button
8
+
9
+
Clause-②: no
10
+
Metadata-protocol: none
11
+
12
+
On a grid with the select-first cell model (the console's list page), a plain click on a link a cell draws used to follow it: an email opened the mail program, a phone number the dialler, a URL a new tab, a lookup or user chip that record's page, and an image thumbnail its lightbox. The cell was not selected, so a reader who meant to select or edit the cell left the list instead. The email and phone cells also drew a copy button beside the value, easy to hit while selecting.
13
+
14
+
A plain click on any of these now selects the cell and opens nothing. To open one: Ctrl/Cmd-click it (as before), press the open button the selected cell shows on hover (only on the selected cell, never on the row hover), or press Ctrl/Cmd+Enter on the selected cell. A cell of several chips opens the first one that way. A double-click on the link edits the cell, as on any other cell. The name link is the one exception and opens the record on a single click, as before. The copy buttons are not drawn inside such a grid; Ctrl/Cmd+C copies the selected cell.
15
+
16
+
Outside the select-first model nothing changes: the record page, related lists, phone cards, kanban cards and every grid whose host does not turn on `cellSelection` keep their links and copy buttons.
17
+
18
+
For renderer authors: a link (`a[href]`) inside a select-first cell is now treated as part of the cell's value. Mark the one link a single click must still follow with `data-opens-on-click`, a non-link control that opens what the value points at with `data-cell-opener`, and a copy control the grid should not draw with `data-cell-copy`.
0 commit comments