Skip to content

Commit e22e358

Browse files
committed
fix(plugin-kanban): a board card that neither drags nor opens is no control: no button role, tab stop, key activation or title hover
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mW5PFQoLHxgbsuizT
1 parent 98ef7be commit e22e358

7 files changed

Lines changed: 66 additions & 22 deletions

File tree

‎.changeset/33548-card-faces-open-nothing.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ fix(plugin-grid, plugin-list, plugin-kanban, app-shell): cards whose click opens
1111
Clause-②: yes (widening) — `ObjectGalleryProps` (published by `@object-ui/plugin-list`) and `ObjectKanbanComponentProps` (published by `@object-ui/plugin-kanban`) each gain one optional prop, `rowOpensRecord?: boolean`, the name `ObjectGridComponentProps` and `ListViewProps` already carry. Absent, every card renders as before. Nothing is removed or narrowed.
1212
Metadata-protocol: none
1313

14-
**Cards that open nothing.** A list's rows open nothing when its view is authored `navigation: { mode: 'none' }`, or when its object's data API serves no single-record read (a list-only object). The grid already drew such rows plain on a desktop; its phone cards, the gallery's cards and the board's cards still drew a pointer and a hover lift, so a tap that did nothing looked like a broken page. `ListView` now hands its `rowOpensRecord` to the gallery and the board as well as the grid, and none of these faces draws a pointer or a hover lift for a card that opens nothing. A board card the reader may drag keeps its grab cursor. Card actions (the phone card's "⋮") stay, and the click still reaches the host.
14+
**Cards that open nothing.** A list's rows open nothing when its view is authored `navigation: { mode: 'none' }`, or when its object's data API serves no single-record read (a list-only object). The grid already drew such rows plain on a desktop; its phone cards, the gallery's cards and the board's cards still drew a pointer and a hover lift, so a tap that did nothing looked like a broken page. `ListView` now hands its `rowOpensRecord` to the gallery and the board as well as the grid, and none of these faces draws a pointer or a hover lift for a card that opens nothing. A board card the reader may not drag is no control at all: no `button` role, no tab stop, no Enter/Space activation and no title hover. A board card the reader may drag keeps its grab cursor and its drag semantics. Card actions (the phone card's "⋮") stay, and the click still reaches the host.
1515

1616
**No new tab on an authored `none`.** On the Console's object list a Cmd/Ctrl-click or a middle click on a row of a view authored `navigation: { mode: 'none' }` opened the record in a new tab, though the view declares no navigation. It now opens nothing, like a plain click. This supersedes the sentence in the `33317-row-opens-nothing-plain` note that says such a click "still opens the record in a new tab, as before". Rows that open a drawer or a page still open a new tab on a Cmd/Ctrl or middle click.

‎content/docs/frontend/plugins/plugin-kanban.mdx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ export function useBoard(initialColumns: KanbanColumn[]) {
159159

160160
A host that owns the card click (`onRowClick`) and knows it opens nothing for
161161
these cards passes the React prop `rowOpensRecord={false}` to `ObjectKanban`: a
162-
card that cannot be dragged then draws no pointer and no hover lift, and a card
163-
that can keeps its grab cursor. The click still reaches `onRowClick`. Absent
162+
card that cannot be dragged then is no control at all (no `button` role, no tab
163+
stop, no Enter/Space activation, no pointer, hover lift or title hover), and a
164+
card that can keeps its grab cursor and its drag semantics. The click still reaches `onRowClick`. Absent
164165
(or `true`), every card is drawn as before. It is a host prop, not a schema
165166
key: list metadata cannot set it. The console passes `false` for a view
166167
authored `navigation: { mode: 'none' }` and for an object whose data API serves

‎ui/packages/app-shell/src/views/ObjectView.cardFacesOpenNothing-33548.test.tsx‎

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
* (its served operations leave `get` out, `servesRecordRead`). The host hands
1717
* that answer down as `rowOpensRecord`, and each card face reads it: the
1818
* gallery card, the board card and the phone card draw no pointer and no hover
19-
* lift, and a tap on one opens nothing. Card actions stay (the phone card's
20-
* "⋮"), and a board card the reader may drag keeps its grab cursor.
19+
* lift, and a tap on one opens nothing. A board card that cannot be dragged
20+
* either is no control at all: no `button` role, no tab stop, no title hover.
21+
* Card actions stay (the phone card's "⋮"), and a board card the reader may
22+
* drag keeps its drag semantics.
2123
*
2224
* Driven through the real `ObjectView`, `ListView`, gallery, board and grid,
2325
* and the real `MePermissionsProvider`: one differential per face, the same
@@ -273,6 +275,16 @@ async function phoneCard(title: string): Promise<HTMLElement> {
273275
return card as HTMLElement;
274276
}
275277

278+
/** Whether the board card's wrapper is a control: a `button` a Tab reaches. */
279+
function isBoardControl(control: HTMLElement): boolean {
280+
return control.getAttribute('role') === 'button' && control.getAttribute('tabindex') === '0';
281+
}
282+
283+
/** Whether the board card's face drives its title's hover colour (`group` → `group-hover:text-primary`). */
284+
function hasTitleHover(face: HTMLElement): boolean {
285+
return /(^|\s)group(\s|$)/.test(face.className) && face.querySelector('[class*="group-hover:"]') !== null;
286+
}
287+
276288
/** Whether `el` wears a clickable face: the pointer, or a hover lift / wash. */
277289
function looksClickable(el: HTMLElement): boolean {
278290
return /(^|\s)(cursor-pointer|hover:shadow-lg|hover:bg-accent\/50)(\s|$)/.test(el.className);
@@ -334,17 +346,41 @@ describe('objectstack#33548 — board cards on a list whose rows open nothing',
334346
expect(openSpy).not.toHaveBeenCalled();
335347
});
336348

337-
it('authored `none`, a card the reader may drag: the grab cursor stays, and no pointer is added', async () => {
349+
it('authored `none`, a card the reader may not drag: the card is no control — no button role, no tab stop, no title hover', async () => {
350+
await mountList({ view: { type: 'kanban', navigation: { mode: 'none' } }, allowEdit: false });
351+
const { control, face } = await boardCard('c1');
352+
expect(isBoardControl(control)).toBe(false);
353+
expect(hasTitleHover(face)).toBe(false);
354+
});
355+
356+
it('a list-only object, a card the reader may not drag: the card is no control either', async () => {
357+
await mountList({ view: { type: 'kanban' }, apiOperations: LIST_ONLY_OPERATIONS, allowEdit: false });
358+
const { control, face } = await boardCard('c1');
359+
expect(isBoardControl(control)).toBe(false);
360+
expect(hasTitleHover(face)).toBe(false);
361+
});
362+
363+
it('authored `none`, a card the reader may drag: it keeps its drag semantics — the grab cursor, the button role and the tab stop — and gains no pointer', async () => {
338364
await mountList({ view: { type: 'kanban', navigation: { mode: 'none' } } });
339-
const { face } = await boardCard('c1');
365+
const { control, face } = await boardCard('c1');
340366
expect(face.className).toMatch(/(^|\s)cursor-grab(\s|$)/);
341367
expect(face.className).not.toMatch(/(^|\s)cursor-pointer(\s|$)/);
368+
expect(isBoardControl(control)).toBe(true);
342369
});
343370

344-
it('CONTROL — the default drawer, a card the reader may not drag: the card wears the pointer and a tap opens the drawer', async () => {
371+
it('CONTROL — the default drawer, a card the reader may not drag: a control with the pointer and title hover; Enter opens the drawer', async () => {
345372
await mountList({ view: { type: 'kanban' }, allowEdit: false });
346373
const { control, face } = await boardCard('c1');
347374
expect(face.className).toMatch(/(^|\s)cursor-pointer(\s|$)/);
375+
expect(isBoardControl(control)).toBe(true);
376+
expect(hasTitleHover(face)).toBe(true);
377+
fireEvent.keyDown(control, { key: 'Enter' });
378+
await waitFor(() => expect(location()).toContain('recordId=c1'));
379+
});
380+
381+
it('CONTROL — the default drawer: a tap on the card opens the drawer', async () => {
382+
await mountList({ view: { type: 'kanban' }, allowEdit: false });
383+
const { control } = await boardCard('c1');
348384
fireEvent.click(control);
349385
await waitFor(() => expect(location()).toContain('recordId=c1'));
350386
});

‎ui/packages/plugin-kanban/README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,9 @@ opens nothing.
211211

212212
A host that owns the card click (`onRowClick`) and knows it opens nothing for
213213
these cards passes the React prop `rowOpensRecord={false}` (objectstack#33548):
214-
a card that cannot be dragged then draws no pointer and no hover lift, and a
215-
card that can keeps its grab cursor. The click still reaches `onRowClick`.
214+
a card that cannot be dragged then is no control at all (no `button` role, no
215+
tab stop, no Enter/Space activation, no pointer, hover lift or title hover), and
216+
a card that can keeps its grab cursor and its drag semantics. The click still reaches `onRowClick`.
216217
Absent (or `true`), every card is drawn as before. It is a host prop, not a
217218
schema key: `ListView` hands it down, and the console passes `false` for a view
218219
authored `navigation: { mode: 'none' }` and for a list-only object.

‎ui/packages/plugin-kanban/src/KanbanImpl.tsx‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ export interface KanbanBoardProps {
229229
/**
230230
* Whether a click on a card opens anything, as the host that owns the click
231231
* knows it — `ObjectKanban`'s `rowOpensRecord` (objectstack#33548). `false` ⇒
232-
* a card that cannot be dragged draws no pointer; the click still reaches
233-
* `onCardClick`. Absent (or `true`) ⇒ every card is drawn as before.
232+
* a card that cannot be dragged is no control (no `button` role, tab stop,
233+
* key activation, pointer or hover); the click still reaches `onCardClick`. Absent (or `true`) ⇒ every card is drawn as before.
234234
*/
235235
rowOpensRecord?: boolean
236236
/**
@@ -328,6 +328,10 @@ function SortableCard({ card, onCardClick, conditionalFormatting, objectFields }
328328
// `aria-disabled` (objectui#12082).
329329
const movable = React.useContext(KanbanCardsMovable)
330330
const opens = React.useContext(KanbanCardsOpenRecord)
331+
// A card that neither drags nor opens (objectstack#33548) is no control: no
332+
// `button` role, no tab stop, no key activation and no hover-as-link face.
333+
// Its click still reaches `onCardClick`, which the host routes to nothing.
334+
const control = movable || opens
331335
const {
332336
attributes,
333337
listeners,
@@ -359,15 +363,15 @@ function SortableCard({ card, onCardClick, conditionalFormatting, objectFields }
359363
// description dnd-kit points `aria-describedby` at (objectui#12837) stays
360364
// on the focusable element, where it is read.
361365
<div role="listitem" aria-label={card.title}>
362-
<div ref={setNodeRef} style={style} {...attributes} {...listeners} role="button" aria-label={card.title}
366+
<div ref={setNodeRef} style={style} {...(control ? attributes : {})} {...listeners} role={control ? 'button' : undefined} aria-label={control ? card.title : undefined}
363367
// objectui#12725 — names the card's record on its element, so a host
364368
// (the Studio canvas) can tell which card a click landed on.
365369
data-kanban-card={card.id}
366370
onClick={(e) => onCardClick?.(card, e)}
367371
onKeyDown={(e) => {
368372
// A key on something inside the card (a link a field renders) is that
369373
// element's own; only the card's own key opens it.
370-
if (e.target !== e.currentTarget) return
374+
if (!control || e.target !== e.currentTarget) return
371375
if (e.key === 'Enter') {
372376
e.preventDefault()
373377
onCardClick?.(card, e)
@@ -379,16 +383,16 @@ function SortableCard({ card, onCardClick, conditionalFormatting, objectFields }
379383
}
380384
}}
381385
onKeyUp={(e) => {
382-
if (e.target !== e.currentTarget) return
386+
if (!control || e.target !== e.currentTarget) return
383387
if (e.key === ' ') {
384388
e.preventDefault()
385389
onCardClick?.(card, e)
386390
}
387391
}}
388392
>
389-
{/* A card that neither drags nor opens (objectstack#33548) draws no
390-
pointer and no hover lift: nothing about it answers a click. */}
391-
<Card className={cn("mb-2 border-border border-l-4 border-l-primary/40 bg-card/60 transition-all duration-300 group touch-manipulation", (movable || opens) && "hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10", movable ? "cursor-grab active:cursor-grabbing" : opens && "cursor-pointer")} style={cardStyles}>
393+
{/* A card that is no control draws no pointer, no hover lift and no
394+
title hover (`group` drives the title's `group-hover:text-primary`). */}
395+
<Card className={cn("mb-2 border-border border-l-4 border-l-primary/40 bg-card/60 transition-all duration-300 touch-manipulation", control && "group hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10", movable ? "cursor-grab active:cursor-grabbing" : opens && "cursor-pointer")} style={cardStyles}>
392396
{card.coverImage && (
393397
<div className="w-full h-32 overflow-hidden rounded-t-lg">
394398
<img

‎ui/packages/plugin-kanban/src/ObjectKanban.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,9 @@ export interface ObjectKanbanComponentProps {
424424
* Whether a click on a card opens anything, as the host that owns the click
425425
* (`onRowClick`) knows it — the grid's `rowOpensRecord`, handed down by
426426
* `ListView` (objectstack#33548). `false` ⇒ a card that cannot be dragged
427-
* draws no pointer; the click still reaches `onRowClick`, and a draggable
428-
* card keeps its grab cursor. Absent (or `true`) ⇒ every card is drawn as
427+
* is no control (no `button` role, tab stop, key activation, pointer or
428+
* hover); the click still reaches `onRowClick`, and a draggable card keeps
429+
* its grab cursor and drag semantics. Absent (or `true`) ⇒ every card is drawn as
429430
* before.
430431
*
431432
* A RUNTIME prop, never authored metadata: the host resolves it, and no node

‎ui/packages/plugin-list/README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@ view's own `rowOpensRecord`:
248248
text and its row context menu offers no Open; on a phone its row cards draw no
249249
pointer and no hover wash;
250250
- the gallery's cards draw no pointer and no hover lift;
251-
- the board's cards (see `@object-ui/plugin-kanban`) draw no pointer, and no
252-
hover lift where the card cannot be dragged either.
251+
- the board's cards (see `@object-ui/plugin-kanban`) draw no pointer; a card
252+
that cannot be dragged either is no control (no `button` role, no tab stop,
253+
no hover lift).
253254

254255
The click still reaches `onRowClick` on every face, and row and card actions
255256
stay. No other view type is handed it. This is a React prop for the host app,

0 commit comments

Comments
 (0)