Skip to content

fix(components): a list row's Edit or Delete greyed by disabledWhen says why - #35331

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35293-row-action-reason
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35293-row-action-reason

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

Fixes #35293

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ
Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:列表(数据表)每行「⋮」菜单里的「编辑」「删除」,在对象写了 userActions.edit.disabledWhen(或 delete.disabledWhen)且条件成立而变灰时,现在在菜单项标签下方显示第二行原因「对此记录不可用」(已有通用句,11 种语言已有翻译),读屏也能读到;与 fix(app-shell, components): a record Edit or Delete greyed by disabledWhen says why #35288 给记录页「···」菜单的样子一致。
  • 为什么改:裁决 6996106574(路线 B,通用原因,不改协议、不加键)。记录页自 fix(app-shell, components): a record Edit or Delete greyed by disabledWhen says why #35288 起已说明原因,列表行仍然无声。
  • 风险与回滚:只改界面一个组件,不改协议、不加可写键、不加翻译键。按钮可用(未写条件或条件不成立)时不显示原因,和以前完全一样。回滚=还原本 PR。
  • 先看:ui/packages/components/src/renderers/complex/data-table.tsx 的 DataTableBuiltinRowActionItem(原因只在声明的 disabledWhen 成立时给,且在提前返回之前调用钩子);data-table-builtin-row-action-predicates.test.tsx 新增的 describe。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/components/src/renderers/complex/__tests__/data-table-builtin-row-action-predicates.test.tsx,预期 9 条全绿,其中「a disabledWhen-greyed item says why」4 条通过。
  • 需要你做的:无,席位落地。

What changes

  • DataTableBuiltinRowActionItem (the data-table row menu's built-in Edit / Delete) now hands its disabledWhen verdict to the existing useDisabledReason hook, the one DataTableRowActionItem in the same file already uses for custom row actions. When the declared disabledWhen holds, the item shows the generic actions.notAvailableForRecord sentence as a visible second line under its label (DisabledReasonMenuLabel) and as its accessible description (menuItemReasonAria); its accessible name stays the label. That is the overflow-entry face fix(app-shell, components): a record Edit or Delete greyed by disabledWhen says why #35288 gave the record page.
  • userActions declares no reason key, so the sentence is always the generic one (ruling 6996106574, route B).
  • An item that is on, with no predicate or with a predicate that does not hold, renders exactly as before: bare label, no ARIA added.
  • No packages/spec/** change, no new i18n key, no new exported prop or type.

Tests

Local runs, head 2170bf0
  • New describe in the existing harness data-table-builtin-row-action-predicates.test.tsx: Edit and Delete greyed by disabledWhen show the reason as a visible second line and description, and are still found by role menuitem with the label as name; controls: no predicate gives no reason, a predicate that does not hold gives no reason.
  • pnpm --dir ui exec vitest run on the 4 data-table row-action files: Test Files 4 passed (4), Tests 48 passed (48), lock VERDICT command-exit 0.
  • Wider: the 35 data-table*.test.tsx files in @object-ui/components plus the 7 ui test files outside it that render built-in row predicates (plugin-detail, plugin-designer, plugin-view, app-shell): Test Files 42 passed (42), Tests 262 passed (262), lock VERDICT command-exit 0. plugin-grid has its own row item and is not touched.
  • pnpm --filter @object-ui/components run type-check (both tsc --noEmit and tsc -p tsconfig.test.json): lock VERDICT command-exit 0.
  • Ablation (one, on the tested behaviour), via scripts/ablation-replace.mjs: useDisabledReason(disabled) replaced with useDisabledReason(false) (anchor 1 to 0, blob d0f38ee7 to 07aaebe3). Result: Tests 2 failed | 7 passed (9); the two red are the two positive pins (edit, delete), every control stayed green. Restored by the tool: blob back to d0f38ee7 = HEAD blob, git diff HEAD empty. No dist step: the test imports the component from source by relative path.

Acceptance notes

  • Out of scope, same family, not changed here (fence: file surface is data-table.tsx): plugin-grid's BuiltinRowActionItem in ui/packages/plugin-grid/src/components/RowActionMenu.tsx, the row menu ObjectGrid draws for an object's list view, greys the built-in Edit / Delete under disabledWhen with the same silence (DropdownMenuItem disabled plus label, no reason). Named producer: the showcase invoice object declares userActions.edit.disabledWhen on record.status == 'paid'. Reported to the seat for the family.

Verification

Gate families derived for this diff

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 2170bf0 derived 38 families; all 38 ran locally and exit 0 (--ran reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN, a derived zero with every exit code recorded). pnpm --dir ui exec vitest run scripts/: Test Files 171 passed | 2 skipped (173). pnpm check:new-line-citations: 0 new citation(s). test:repo, repo-wide scans and the remaining CI families are CI's.


Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ

@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Final head for review · area ux-2 · 2026-11-19T05:34Z
Head: 2170bf0b8de9f064cb182e6eb9b412cbf3b900df — all check runs on it concluded: 45 success, 13 skipped, 0 failed. Mergeable: clean.
Fixes #35293 · route B per ruling 6996106574 · Clause-②: no (reuses actions.notAvailableForRecord, no new key, no new export) · Metadata-protocol: none · +73/−5 over 3 files. Not governed (0 of 3).
Review route: L1-a thread. Landing after its ACCEPT, by the area.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head 2170bf0b8de9f064cb182e6eb9b412cbf3b900df · 2026-11-19T05:35Z

  • 形态: draft → main, 3 files, +73/−5. Fixes #35293. check-governed-merges --pr 35331: 0 of 3 paths governed, 78 lines ≤ 3000 → ordinary queue landing.
    • Clause-②: no holds. DataTableBuiltinRowActionItem's props are unchanged, and its docblock says it is not part of the package's public API.
    • The helpers useDisabledReason, menuItemReasonAria and DisabledReasonMenuLabel are the existing ../action/disabled-reason ones that DataTableRowActionItem already uses.
    • No locale key is added: actions.notAvailableForRecord is present in all 11 built-in locales. Metadata-protocol: none.
  • Fixes vs the card: the card asks for route B on the list row's built-in Edit/Delete, matching fix(app-shell, components): a record Edit or Delete greyed by disabledWhen says why #35288's overflow entry, with pins and ablation red. Done:
    • disabled (declared disabledWhen holding) feeds useDisabledReason(disabled) with no declared reason, so the text is the generic sentence.
    • The item gets the second line and aria-describedby, and its accessible name stays the label.
    • Pins and ablation are below. So Fixes is right.
  • Hook order: useDisabledReason calls useId and translation hooks, so the move of if (!isVisible) return null below it is required. Otherwise a row toggling visibility would change the hook count.
  • Pending verdict: follow-up grid list view: a row's built-in Edit / Delete greyed by userActions.*.disabledWhen gives no reason (plugin-grid RowActionMenu), unlike data-table since #35293 #35334 warns a pending verdict must not earn the reason. That does not arise here. useRowPredicate is evaluated synchronously with fallback: false, so a not-yet-holding predicate reads false and gets no reason, and the CONTROL pin holds it.
  • Changeset: .changeset/35293-row-disabledwhen-reason.md, patch on @object-ui/components. I read each sentence against the diff:
    • "greyed Edit (or Delete) and said nothing about why" matches the old bare DropdownMenuItem.
    • "the generic reason the record page gives for the same verdict ... in every shipped language" matches actions.notAvailableForRecord (11 locales) and fix(app-shell, components): a record Edit or Delete greyed by disabledWhen says why #35288 on main.
    • "a visible second line under its label and as its accessible description; its accessible name stays the label" matches DisabledReasonMenuLabel plus menuItemReasonAria, and the pin's getByRole('menuitem', { name }).
    • "An item that is on ... gives no reason, as before" matches disabledReason undefined, with the label bare.
  • 接受的偏差: (1) The scripts/ vitest run used --maxWorkers=2. (2) test:repo was left to CI because no repo-project test was touched. Both are procedural.
  • Pins:
    • Edit and Delete greyed by disabledWhen (it.each): aria-disabled, the reason visible as description, and the name equal to the label.
    • CONTROL: no predicate gives no reason.
    • CONTROL: a predicate not holding gives no reason.
    • The dev reports the ablation red at 2/9.
  • 门禁: check-runs on head 2170bf0b: 45 success, 13 skipped, 0 failure. The successes include Test UI and all 16 shards, Type Check UI, Lint UI, Build & E2E UI, Live E2E UI, Lint & Repo Gates, and Check Changeset.
  • 范围外去向: the same gap in plugin-grid's RowActionMenu is filed as grid list view: a row's built-in Edit / Delete greyed by userActions.*.disabledWhen gives no reason (plugin-grid RowActionMenu), unlike data-table since #35293 #35334 (p2, pm:queue, nested under record page: an Edit disabled by userActions.edit.disabledWhen gives no reason, unlike the state and approval locks #35135), with the pending-verdict caution. That is the right carrier.
  • 落地条款: K = 7 first-parent commits on main since merge base 00cfb78f (< 15). No locale pack. Non-governed ⇒ ux-2 lands per landing-operations.md (pr_ready + auto-merge) after this ACCEPT. On MERGED, close-out on list view: a row's built-in Edit / Delete greyed by userActions.*.disabledWhen gives no reason, unlike the record page since #35135 #35293.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Landing · area ux-2 · 2026-11-19T05:36Z

reading value
L1-a ACCEPT comment 7000768398 at head 2170bf0b8de9f064cb182e6eb9b412cbf3b900df (= current head); both deviations accepted there
check-governed-merges --pr 35331 NOT governed, 0 of 3 paths, 78 lines ≤ 3000; K = 8 from merge base 00cfb78f, no change on main since to components/src/renderers/{complex,action} or the locale packs

State: draft → ready + auto-merge (merge queue). #35293 closes on merge via Fixes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 05:37
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 3819afe Nov 19, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35293-row-action-reason branch November 19, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list view: a row's built-in Edit / Delete greyed by userActions.*.disabledWhen gives no reason, unlike the record page since #35135

2 participants