From b9a7b9e3d3a7c3986ee3affff7307b6f5f097364 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 13:20:25 +0000 Subject: [PATCH 1/3] fix(plugin-grid): list pages lift record_row actions without a selection column (wip) Claude-Session: https://claude.ai/code/session_01L9qibzVCaQPuEu6rGmqH8J Co-authored-by: Claude --- ui/packages/plugin-grid/src/ObjectGrid.tsx | 36 +++- ...tGrid.rowActionsNoSelection-39435.test.tsx | 172 ++++++++++++++++++ .../src/objectGridActionsColumn.tsx | 109 +++++++---- 3 files changed, 276 insertions(+), 41 deletions(-) create mode 100644 ui/packages/plugin-grid/src/__tests__/ObjectGrid.rowActionsNoSelection-39435.test.tsx diff --git a/ui/packages/plugin-grid/src/ObjectGrid.tsx b/ui/packages/plugin-grid/src/ObjectGrid.tsx index f252519a5b1..e4237d9f8cf 100644 --- a/ui/packages/plugin-grid/src/ObjectGrid.tsx +++ b/ui/packages/plugin-grid/src/ObjectGrid.tsx @@ -130,7 +130,7 @@ import { useObjectGridColumnState } from './objectGridColumnState'; import { useObjectGridMobile } from './objectGridMobile'; import { useObjectGridGenerateColumns } from './objectGridGenerateColumns'; import { resolveObjectGridPersistedColumns } from './objectGridPersistedColumns'; -import { resolveObjectGridActionsColumn } from './objectGridActionsColumn'; +import { resolveObjectGridActionsColumn, resolveObjectGridRowActionOffer } from './objectGridActionsColumn'; import { useInlineRowActionFold } from './objectGridInlineActionFold'; import { BULK_SELECT_ALL_MATCHING_CAP } from './bulkSelectAllMatchingCap'; import { CHANGE_OWNER_BULK_ACTION } from './components/BulkActionBar'; @@ -1993,6 +1993,20 @@ export const ObjectGrid: React.FC = ({ key: 'rowActions', names: undeclaredRowActions, ready: !objectSchemaAwaited, basis: undeclaredNamesBasis, address: undeclaredNamesAddress, }); + // The host predicate scope (row-action visibility, conditional formatting + // below) and objectui#12708's capability gate, the one `RowActionMenu` + // applies per row: read here, above the early returns where no hook may + // sit, so the selection mode below and the Actions column's verdict see the + // same declared set. + const predicateScope = usePredicateScope(); + const mayInvokeRowAction = useCapabilityGate(); + // Whether a row offers an action (`./objectGridActionsColumn`): the same + // plan the Actions column and the row's menus are drawn from. + const rowActionOffer = resolveObjectGridRowActionOffer({ + schema, data, objectSchema, operations, resolvedRowActionDefs, wantEditAction, wantDeleteAction, + mayInvokeRowAction, rowOperations, canEdit, canDelete, recordVerdict, approvalLocks, predicateScope, + onEdit, onDelete, editPredicates, deletePredicates, foldInlineRowActions: inlineActionFold.folded, + }); let selectionMode: 'none' | 'single' | 'multiple' | boolean = false; if (schema.selection !== undefined) { // "presence enables; an explicit off wins" — the ONE rule both @@ -2016,7 +2030,19 @@ export const ObjectGrid: React.FC = ({ // wires the bulk Change Owner whose grant it reads only once a selection // is open (objectstack#35403): without the selection it never gets asked. selectionMode = 'multiple'; + } else if (listPageGrid && rowActionOffer.anyRowOffersAction()) { + // objectstack#39435 — a list page's rows draw no actions of their own + // (objectstack#35554); one selected row lifts them into the selection bar. + // So where no author asked for selection and no bulk action opened one, + // rows that offer an action are selectable one at a time — otherwise the + // row's context menu would be the only way to reach them. + selectionMode = 'single'; } + // objectstack#39435 — the author switched selection off (`selection.type: + // 'none'`, legacy `selectable: false`): no selection can lift a row's + // actions, so a list page's rows keep their own row controls. + const selectionAuthoredOff = + !selectionMode && (schema.selection !== undefined || schema.selectable !== undefined); // `selection.type: 'single'` caps the selection at one row (the data-table // enforces replace-on-select, #2941), so the cross-page "select all N // matching" escalation must never be offered. @@ -2065,11 +2091,7 @@ export const ObjectGrid: React.FC = ({ // and ListView reach the identical verdict and the whole platform speaks one // expression dialect. The host predicate scope is bound so `features.*` // predicates resolve, mirroring row-action visibility. - const predicateScope = usePredicateScope(); - // objectui#12708 — the row actions' capability gate, the one `RowActionMenu` - // applies per row, read here too so the Actions column's verdict (below the - // early returns, where no hook may sit) sees the same declared set. - const mayInvokeRowAction = useCapabilityGate(); + // (`predicateScope` is read above, beside the selection mode.) const getRowStyle = useCallback((row: Record): React.CSSProperties | undefined => { const rules = schema.conditionalFormatting; if (!rules || rules.length === 0) return undefined; @@ -2543,7 +2565,7 @@ export const ObjectGrid: React.FC = ({ wantEditAction, wantDeleteAction, mayInvokeRowAction, rowOperations, canEdit, canDelete, recordVerdict, approvalLocks, demandRowActions, predicateScope, onEdit, onDelete, editPredicates, deletePredicates, executeAction, setRefreshKey, t, foldInlineRowActions: inlineActionFold.folded, - drawRowControls: !listPageGrid, + drawRowControls: !listPageGrid || selectionAuthoredOff, }); // Density-driven cell padding/font (applied to every column so it actually reaches ). diff --git a/ui/packages/plugin-grid/src/__tests__/ObjectGrid.rowActionsNoSelection-39435.test.tsx b/ui/packages/plugin-grid/src/__tests__/ObjectGrid.rowActionsNoSelection-39435.test.tsx new file mode 100644 index 00000000000..0756d72ee82 --- /dev/null +++ b/ui/packages/plugin-grid/src/__tests__/ObjectGrid.rowActionsNoSelection-39435.test.tsx @@ -0,0 +1,172 @@ +/** + * ObjectUI + * Copyright (c) 2024-present ObjectStack Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/** + * objectstack#39435 — a list page's row actions stay reachable without the + * browser's right-click. + * + * A list page's rows draw no actions of their own (objectstack#35554); one + * selected row lifts them into the selection bar. A grid whose author asked + * for no selection and whose bulk actions opened none had no selection, so + * its `record_row` actions were reachable only through the row's context + * menu. Now: + * + * - rows that offer an action are selectable one at a time, and one selected + * row brings up its actions in the bar; + * - where the author switched selection off, the rows keep their row-end + * controls instead; + * - CONTROL: a list page grid whose rows offer nothing gains no selection + * column, and a grid outside a list page keeps the face it had. + * + * The page column is a fixture built on the same `useListPageScope` the + * Console page bars call; the grid, its table, the selection bar and the menus + * are real. + */ +import { describe, it, expect, beforeEach } from 'vitest'; +import { render, screen, waitFor, fireEvent, within } from '@testing-library/react'; +import '@testing-library/jest-dom'; +import React from 'react'; + +import { ObjectGrid } from '../ObjectGrid'; +import { useListPageScope } from '../listPageScope'; +import { registerAllFields } from '@object-ui/fields'; +import { ActionProvider, SchemaRendererProvider, useAction } from '@object-ui/react'; +import { __clearRecordCrudVerdictCache } from '../hooks/useRecordCrudVerdicts'; + +registerAllFields(); +beforeEach(() => __clearRecordCrudVerdictCache()); + +const apiFetch = async (): Promise => + ({ ok: true, status: 200, json: async () => ({ allowed: true, layers: [] }) }) as unknown as Response; + +const ROWS = [ + { id: 's1', name: 'Laptop session' }, + { id: 's2', name: 'Phone session' }, +]; + +/** A Setup list such as 在线会话: one `record_row` action, no Edit, no Delete, no bulk action. */ +function schemaOf(extra: Record = {}): any { + return { + type: 'object-grid', + objectName: 'sys_session', + columns: [{ field: 'name', label: 'Name' }], + data: { provider: 'value', items: ROWS }, + operations: { update: false, delete: false }, + rowActionDefs: [{ name: 'revoke_session', label: 'Revoke session' }], + ...extra, + }; +} + +/** The fixture page bar: it registers its page column as a list page scope. */ +const PageBar: React.FC = () => { + const [scope, setScope] = React.useState(null); + useListPageScope(scope); + return
setScope(el?.parentElement ?? null)} data-testid="page-bar" />; +}; + +/** Reads what the grid publishes into the action context. */ +const SelectionAvailableProbe: React.FC = () => { + const { runner } = useAction(); + const read = React.useCallback(() => String(runner.getContext().selectionAvailable), [runner]); + const value = React.useSyncExternalStore( + React.useCallback((listener: () => void) => runner.subscribeContext(listener), [runner]), + read, + ); + return {value}; +}; + +function renderGrid(schema: any, { listPage }: { listPage: boolean }) { + return render( + + +
+ {listPage && } + +
+ +
+
, + ); +} + +const rowOf = (name: string) => screen.getByText(name).closest('tr')!; +const actionsHeader = (container: HTMLElement) => container.querySelector('th[data-column-key="_actions"]'); +const bar = () => screen.getByTestId('bulk-actions-bar'); + +describe('objectstack#39435 — a list page grid with row actions and no authored selection', () => { + it('its rows are selectable, and one selected row brings up its actions in the selection bar', async () => { + const { container } = renderGrid(schemaOf(), { listPage: true }); + await waitFor(() => expect(screen.getByText('Laptop session')).toBeInTheDocument()); + // Still no row-end control on a list page. + expect(actionsHeader(container)).toBeNull(); + expect(screen.queryAllByTestId('row-action-trigger')).toHaveLength(0); + // The row-level entry point: the row's checkbox. + await waitFor(() => expect(within(rowOf('Laptop session')).getByRole('checkbox')).toBeInTheDocument()); + expect(screen.getByTestId('selection-available')).toHaveTextContent('true'); + + fireEvent.click(within(rowOf('Laptop session')).getByRole('checkbox')); + await waitFor(() => expect(bar()).toBeInTheDocument()); + expect(within(bar()).getByTestId('bulk-selection-count')).toHaveTextContent('1'); + expect(within(bar()).getByTestId('row-action-inline-revoke_session')).toBeInTheDocument(); + }); + + it('the selection is single: picking a second row replaces the first', async () => { + renderGrid(schemaOf(), { listPage: true }); + await waitFor(() => expect(within(rowOf('Laptop session')).getByRole('checkbox')).toBeInTheDocument()); + fireEvent.click(within(rowOf('Laptop session')).getByRole('checkbox')); + await waitFor(() => expect(bar()).toBeInTheDocument()); + fireEvent.click(within(rowOf('Phone session')).getByRole('checkbox')); + await waitFor(() => + expect(within(rowOf('Phone session')).getByRole('checkbox')).toHaveAttribute('data-state', 'checked'), + ); + expect(within(rowOf('Laptop session')).getByRole('checkbox')).not.toHaveAttribute('data-state', 'checked'); + expect(within(bar()).getByTestId('bulk-selection-count')).toHaveTextContent('1'); + expect(within(bar()).getByTestId('row-action-inline-revoke_session')).toBeInTheDocument(); + }); +}); + +describe('objectstack#39435 — a list page grid whose author switched selection off', () => { + it.each([ + ['selection.type: none', { selection: { type: 'none' } }], + ['selectable: false', { selectable: false }], + ])('%s: the rows keep their row-end controls and draw no checkbox', async (_label, extra) => { + const { container } = renderGrid(schemaOf(extra), { listPage: true }); + await waitFor(() => expect(screen.getByText('Laptop session')).toBeInTheDocument()); + await waitFor(() => expect(actionsHeader(container)).not.toBeNull()); + expect(within(rowOf('Laptop session')).getByTestId('row-action-trigger')).toBeInTheDocument(); + expect(screen.queryAllByRole('checkbox')).toHaveLength(0); + expect(screen.getByTestId('selection-available')).toHaveTextContent('false'); + }); +}); + +describe('objectstack#39435 — CONTROLS', () => { + it('a list page grid whose rows offer no action gains no selection column and no row control', async () => { + const { container } = renderGrid(schemaOf({ rowActionDefs: [] }), { listPage: true }); + await waitFor(() => expect(screen.getByText('Laptop session')).toBeInTheDocument()); + expect(screen.queryAllByRole('checkbox')).toHaveLength(0); + expect(actionsHeader(container)).toBeNull(); + expect(screen.getByTestId('selection-available')).toHaveTextContent('false'); + }); + + it('a list page grid whose only row action is hidden on every row gains no selection column', async () => { + const hidden = schemaOf({ + rowActionDefs: [{ name: 'revoke_session', label: 'Revoke session', visible: 'false' }], + }); + renderGrid(hidden, { listPage: true }); + await waitFor(() => expect(screen.getByText('Laptop session')).toBeInTheDocument()); + expect(screen.queryAllByRole('checkbox')).toHaveLength(0); + }); + + it('a grid outside a list page keeps its Actions column and gains no selection', async () => { + const { container } = renderGrid(schemaOf(), { listPage: false }); + await waitFor(() => expect(screen.getByText('Laptop session')).toBeInTheDocument()); + await waitFor(() => expect(actionsHeader(container)).not.toBeNull()); + expect(screen.queryAllByRole('checkbox')).toHaveLength(0); + expect(screen.getByTestId('selection-available')).toHaveTextContent('false'); + }); +}); diff --git a/ui/packages/plugin-grid/src/objectGridActionsColumn.tsx b/ui/packages/plugin-grid/src/objectGridActionsColumn.tsx index 1ed3030244b..499019eb131 100644 --- a/ui/packages/plugin-grid/src/objectGridActionsColumn.tsx +++ b/ui/packages/plugin-grid/src/objectGridActionsColumn.tsx @@ -22,21 +22,11 @@ import type { ObjectGridComponentProps } from './ObjectGrid'; type RowCrudAffordances = ReturnType; -/** - * The persisted columns plus the Actions column when a row on screen offers an - * action, split into the pinned and unpinned sets the table layout reads. - * `ObjectGrid` calls it where these lines used to stand. - */ -export function resolveObjectGridActionsColumn({ - schema, data, objectSchema, persistedColumns, operations, resolvedRowActionDefs, - wantEditAction, wantDeleteAction, mayInvokeRowAction, rowOperations, canEdit, canDelete, - recordVerdict, approvalLocks, demandRowActions, predicateScope, onEdit, onDelete, editPredicates, - deletePredicates, executeAction, setRefreshKey, t, foldInlineRowActions = false, drawRowControls = true, -}: { +/** What both resolvers below read to answer whether a row offers an action. */ +type RowActionOfferInputs = { schema: ObjectGridSchema; data: any[]; objectSchema: any; - persistedColumns: ReturnType['persistedColumns']; operations: ObjectGridSchema['operations'] | { update: boolean; delete: boolean }; resolvedRowActionDefs: ReturnType['defs']; wantEditAction: boolean; @@ -60,20 +50,11 @@ export function resolveObjectGridActionsColumn({ * delete with `RECORD_LOCKED`. */ approvalLocks: RowApprovalLocks; - /** - * objectstack#36911 — a row's actions are reached for: asks the - * record-grained verdicts and the page's approval locks - * (`RowActionMenuProps.onActionsDemand`). - */ - demandRowActions: () => void; predicateScope: ReturnType; onEdit: ObjectGridComponentProps['onEdit']; onDelete: ObjectGridComponentProps['onDelete']; editPredicates: RowCrudAffordances['editPredicates']; deletePredicates: RowCrudAffordances['deletePredicates']; - executeAction: ReturnType['execute']; - setRefreshKey: React.Dispatch>; - t: ReturnType['t']; /** * objectstack#33230 — draw no inline button: every primary action renders at * the top of its row's "⋮" menu instead. `ObjectGrid` sets it while the @@ -81,19 +62,27 @@ export function resolveObjectGridActionsColumn({ * (`./objectGridInlineActionFold`). */ foldInlineRowActions?: boolean; - /** - * objectstack#35554 — `false` on a list page, whose rows carry no control at - * all: no Actions column is drawn, and a row's actions are reached through - * the page bar (its selection) and the row's context menu, which read the - * same `rowActionMenuProps`. - */ - drawRowControls?: boolean; -}) { +}; + +/** + * Whether a row offers an action: the plan `RowActionMenu` renders a row's + * menus from, once the capability gate, the per-record predicates and the + * record-level verdicts are applied. A plain function, so `ObjectGrid` reads it + * above its early returns too (objectstack#39435: a list page's rows are + * selectable when one of them offers an action, so the selection bar can lift + * it). + */ +export function resolveObjectGridRowActionOffer({ + schema, data, objectSchema, operations, resolvedRowActionDefs, wantEditAction, wantDeleteAction, + mayInvokeRowAction, rowOperations, canEdit, canDelete, recordVerdict, approvalLocks, predicateScope, + onEdit, onDelete, editPredicates, deletePredicates, foldInlineRowActions = false, +}: RowActionOfferInputs) { // `operations`, the row-action lists and the row CRUD affordance verdict are - // resolved further up, next to the permission reads they AND with — this - // render path sits BELOW the error / loading early returns, and [#4296] the - // record-level verdict they feed is fetched by a hook, which may not sit - // behind a conditional return. + // resolved further up, next to the permission reads they AND with — the + // Actions column's render path sits BELOW the error / loading early returns, + // and [#4296] the record-level verdict they feed is fetched by a hook, which + // may not sit behind a conditional return. Nothing here is a hook, so this + // reads the same above those returns as below them. const hasActions = !!(operations && (operations.update || operations.delete)); const hasRowActions = resolvedRowActionDefs.length > 0 || wantEditAction || wantDeleteAction; @@ -153,7 +142,59 @@ export function resolveObjectGridActionsColumn({ }); return plan.inline.length > 0 || plan.menuCount > 0; }; - const drawActionsColumn = drawRowControls && (hasActions || hasRowActions) && data.some(rowOffersAction); + return { + hasActions, + hasRowActions, + maxInlineRowActions, + rowCrudVerdicts, + /** This row's plan holds an inline button or a menu item. */ + rowOffersAction, + /** A face-level answer: the table is wired for row actions at all. */ + tableOffersRowActions: hasActions || hasRowActions, + /** A row on screen offers an action. One row is enough, so the read stops at the first. */ + anyRowOffersAction: (): boolean => (hasActions || hasRowActions) && data.some(rowOffersAction), + }; +} + +/** + * The persisted columns plus the Actions column when a row on screen offers an + * action, split into the pinned and unpinned sets the table layout reads. + * `ObjectGrid` calls it where these lines used to stand. + */ +export function resolveObjectGridActionsColumn({ + schema, data, objectSchema, persistedColumns, operations, resolvedRowActionDefs, + wantEditAction, wantDeleteAction, mayInvokeRowAction, rowOperations, canEdit, canDelete, + recordVerdict, approvalLocks, demandRowActions, predicateScope, onEdit, onDelete, editPredicates, + deletePredicates, executeAction, setRefreshKey, t, foldInlineRowActions = false, drawRowControls = true, +}: RowActionOfferInputs & { + persistedColumns: ReturnType['persistedColumns']; + /** + * objectstack#36911 — a row's actions are reached for: asks the + * record-grained verdicts and the page's approval locks + * (`RowActionMenuProps.onActionsDemand`). + */ + demandRowActions: () => void; + executeAction: ReturnType['execute']; + setRefreshKey: React.Dispatch>; + t: ReturnType['t']; + /** + * objectstack#35554 — `false` on a list page, whose rows carry no control at + * all: no Actions column is drawn, and a row's actions are reached through + * the page bar (its selection) and the row's context menu, which read the + * same `rowActionMenuProps`. objectstack#39435 — `true` again on a list + * page whose author switched selection off: no selection can lift a row's + * actions there, so the row keeps its own. + */ + drawRowControls?: boolean; +}) { + const { + hasActions, hasRowActions, maxInlineRowActions, rowCrudVerdicts, rowOffersAction, anyRowOffersAction, + } = resolveObjectGridRowActionOffer({ + schema, data, objectSchema, operations, resolvedRowActionDefs, wantEditAction, wantDeleteAction, + mayInvokeRowAction, rowOperations, canEdit, canDelete, recordVerdict, approvalLocks, predicateScope, + onEdit, onDelete, editPredicates, deletePredicates, foldInlineRowActions, + }); + const drawActionsColumn = drawRowControls && anyRowOffersAction(); /** * The props ONE row's "⋮" cell renders with — and, verbatim, the props its From 570c06edb335d73f442e5036def2a3d318476d32 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 13:42:48 +0000 Subject: [PATCH 2/3] fix(plugin-grid): only a declared row action opens a list page's single selection Claude-Session: https://claude.ai/code/session_01L9qibzVCaQPuEu6rGmqH8J Co-authored-by: Claude --- ui/packages/plugin-grid/src/ObjectGrid.tsx | 7 ++++--- ...ectGrid.rowActionsNoSelection-39435.test.tsx | 17 +++++++++++++---- .../plugin-grid/src/objectGridActionsColumn.tsx | 16 ++++++++++++++-- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ui/packages/plugin-grid/src/ObjectGrid.tsx b/ui/packages/plugin-grid/src/ObjectGrid.tsx index e4237d9f8cf..930f370d034 100644 --- a/ui/packages/plugin-grid/src/ObjectGrid.tsx +++ b/ui/packages/plugin-grid/src/ObjectGrid.tsx @@ -2030,12 +2030,13 @@ export const ObjectGrid: React.FC = ({ // wires the bulk Change Owner whose grant it reads only once a selection // is open (objectstack#35403): without the selection it never gets asked. selectionMode = 'multiple'; - } else if (listPageGrid && rowActionOffer.anyRowOffersAction()) { + } else if (listPageGrid && rowActionOffer.anyRowOffersDeclaredAction()) { // objectstack#39435 — a list page's rows draw no actions of their own // (objectstack#35554); one selected row lifts them into the selection bar. // So where no author asked for selection and no bulk action opened one, - // rows that offer an action are selectable one at a time — otherwise the - // row's context menu would be the only way to reach them. + // rows that offer a declared row action are selectable one at a time — + // otherwise the row's context menu would be the only way to reach it. The + // built-in Edit / Delete alone open nothing: the opened record offers them. selectionMode = 'single'; } // objectstack#39435 — the author switched selection off (`selection.type: diff --git a/ui/packages/plugin-grid/src/__tests__/ObjectGrid.rowActionsNoSelection-39435.test.tsx b/ui/packages/plugin-grid/src/__tests__/ObjectGrid.rowActionsNoSelection-39435.test.tsx index 0756d72ee82..6d31153cde0 100644 --- a/ui/packages/plugin-grid/src/__tests__/ObjectGrid.rowActionsNoSelection-39435.test.tsx +++ b/ui/packages/plugin-grid/src/__tests__/ObjectGrid.rowActionsNoSelection-39435.test.tsx @@ -20,8 +20,9 @@ * row brings up its actions in the bar; * - where the author switched selection off, the rows keep their row-end * controls instead; - * - CONTROL: a list page grid whose rows offer nothing gains no selection - * column, and a grid outside a list page keeps the face it had. + * - CONTROL: a list page grid whose rows offer nothing, or only the built-in + * Edit (which the opened record offers too), gains no selection column, and + * a grid outside a list page keeps the face it had. * * The page column is a fixture built on the same `useListPageScope` the * Console page bars call; the grid, its table, the selection bar and the menus @@ -80,13 +81,13 @@ const SelectionAvailableProbe: React.FC = () => { return {value}; }; -function renderGrid(schema: any, { listPage }: { listPage: boolean }) { +function renderGrid(schema: any, { listPage, onEdit }: { listPage: boolean; onEdit?: (record: any) => void }) { return render(
{listPage && } - +
@@ -153,6 +154,14 @@ describe('objectstack#39435 — CONTROLS', () => { expect(screen.getByTestId('selection-available')).toHaveTextContent('false'); }); + it('a list page grid whose rows offer only the built-in Edit gains no selection column', async () => { + const editOnly = schemaOf({ rowActionDefs: [], operations: { update: true, delete: false } }); + renderGrid(editOnly, { listPage: true, onEdit: () => {} }); + await waitFor(() => expect(screen.getByText('Laptop session')).toBeInTheDocument()); + expect(screen.queryAllByRole('checkbox')).toHaveLength(0); + expect(screen.getByTestId('selection-available')).toHaveTextContent('false'); + }); + it('a list page grid whose only row action is hidden on every row gains no selection column', async () => { const hidden = schemaOf({ rowActionDefs: [{ name: 'revoke_session', label: 'Revoke session', visible: 'false' }], diff --git a/ui/packages/plugin-grid/src/objectGridActionsColumn.tsx b/ui/packages/plugin-grid/src/objectGridActionsColumn.tsx index 499019eb131..766a0cae380 100644 --- a/ui/packages/plugin-grid/src/objectGridActionsColumn.tsx +++ b/ui/packages/plugin-grid/src/objectGridActionsColumn.tsx @@ -127,8 +127,8 @@ export function resolveObjectGridRowActionOffer({ ), }; }; - const rowOffersAction = (row: any): boolean => { - const plan = planRowActionMenu({ + const planRow = (row: any) => + planRowActionMenu({ row, scope: predicateScope, actionDefs: rowActionDefsGated, @@ -140,8 +140,18 @@ export function resolveObjectGridRowActionOffer({ deletePredicates, objectFields: objectSchema?.fields, }); + const rowOffersAction = (row: any): boolean => { + const plan = planRow(row); return plan.inline.length > 0 || plan.menuCount > 0; }; + // A declared row action (`record_row`, or a legacy `rowActions` name the + // object resolves), not the built-in Edit / Delete: the record itself offers + // those once a row is opened, and a declared one it does not. + const rowOffersDeclaredAction = (row: any): boolean => { + if (rowActionDefsGated.length === 0) return false; + const plan = planRow(row); + return plan.inline.length > 0 || plan.custom.length > 0; + }; return { hasActions, hasRowActions, @@ -153,6 +163,8 @@ export function resolveObjectGridRowActionOffer({ tableOffersRowActions: hasActions || hasRowActions, /** A row on screen offers an action. One row is enough, so the read stops at the first. */ anyRowOffersAction: (): boolean => (hasActions || hasRowActions) && data.some(rowOffersAction), + /** A row on screen offers a declared row action, the built-in Edit / Delete aside. */ + anyRowOffersDeclaredAction: (): boolean => data.some(rowOffersDeclaredAction), }; } From 9aea5db246243a53072571f7d286aa1b064c7c66 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 13:44:11 +0000 Subject: [PATCH 3/3] chore(changeset): list page row actions without a selection column Claude-Session: https://claude.ai/code/session_01L9qibzVCaQPuEu6rGmqH8J Co-authored-by: Claude --- .changeset/39435-list-row-actions-no-selection.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .changeset/39435-list-row-actions-no-selection.md diff --git a/.changeset/39435-list-row-actions-no-selection.md b/.changeset/39435-list-row-actions-no-selection.md new file mode 100644 index 00000000000..c47621be4d5 --- /dev/null +++ b/.changeset/39435-list-row-actions-no-selection.md @@ -0,0 +1,14 @@ +--- +'@object-ui/plugin-grid': patch +--- + +fix(plugin-grid): list pages lift record_row actions without a selection column + +Clause-②: no +Metadata-protocol: none + +On an object's list page the rows draw no actions of their own: one selected row brings up its actions in the selection bar. A list with no selection had no way to select a row, so its declared row actions (`locations: ['record_row']`) could be reached only through the row's right-click menu. Setup lists such as sessions, invitations and API keys were affected: their rows had no checkbox and no selection bar, so Revoke session, Copy invitation link and Revoke API key were hidden. + +- A list page grid whose view declares no `selection` (and no legacy `selectable`), and whose bulk actions open no selection, now lets you select one row at a time when a row on screen offers a declared row action. Selecting a row brings up its actions in the selection bar. +- A list page grid whose view switches selection off (`selection: { type: 'none' }`, or legacy `selectable: false`) draws the row's own actions menu at the end of each row instead, because no selection can show them there. +- Nothing changes on a list whose rows offer only the built-in Edit or Delete, or nothing at all. The same goes for a view that declares its own selection, and for a grid outside a list page (a related list, a page block, the record drawer).