Skip to content

[6.x] Name admin table rows in delete buttons and confirmations - #20633

Merged
riasvdv merged 2 commits into
6.xfrom
admin-table-delete-labels
Nov 12, 2026
Merged

riasvdv merged 2 commits into
6.xfrom
admin-table-delete-labels

Conversation

@riasvdv

@riasvdv riasvdv commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Description

Admin tables (CraftCms\Cms\Ui\Nodes\Table, craft:admin-table) now name the row in its delete button and in deletion confirmations, and count the rows a bulk deletion takes.

 delete button name
-  _deleteLabel ?? "Delete item"
+  _deleteLabel ?? "Delete {row}"            # same label as the row's "Select {row}" checkbox

 row deletion confirm
-  _deleteConfirmMessage ?? deleteConfirmMessage ?? "Are you sure?"
+  _deleteConfirmMessage ?? deleteConfirmMessage ?? "Are you sure you want to delete “{row}”?"

 bulk deletion confirm
-  bulkDeleteConfirmMessage ?? "Are you sure?"
+  bulkDeleteConfirmMessage ?? "Are you sure you want to delete {num} item(s)?"

The row label is the first column's text, or the row's ID when that's empty. Messages a table or row passes in still take precedence.

Found while testing the native Webhooks plugin (craftcms/webhooks#108). The bulk "Set status" and "Actions" menus were also reported as missing from the accessibility tree, but that didn't reproduce: their items are exposed as buttons and work with the keyboard, following craft-action-menu's Disclosure Navigation Menu pattern, so they're unchanged.

Evidence

  • Before: Settings → Sections, accessibility tree: button "Delete item" ×5. Bulk delete confirm: “Are you sure?”
    After: button "Delete Field Showcase", button "Delete Home", … button "Delete Posts". Bulk delete confirm with two rows selected: “Are you sure you want to delete 2 items?”. Sections’ own message is unchanged: “Are you sure you want to delete “Pages” and all its entries?”
  • Before: names rows in their delete buttons and confirmations, and counts the rows a bulk deletion takes fails: Cannot find element with locator: getByRole('button', { name: 'Delete Beta' })
    After: it passes, with the rest of AdminTableData.browser.test.ts (37 tests).
mount table: Beta, Alpha, Gamma (_deleteLabel: "Remove Gamma")
expect buttons "Delete Beta", "Remove Gamma"
click "Delete Alpha"        → confirm("Are you sure you want to delete “Alpha”?")
select 1 row, bulk delete  → confirm("Are you sure you want to delete 1 item?")
select 3 rows, bulk delete → confirm("Are you sure you want to delete 3 items?")
  • Keyboard pass through the bulk bar of a table with statusActions() and bulkDeletable(): Tab reaches “Set status”, Enter focuses “Enabled”, ArrowDown/ArrowUp/Home/End move between items, Escape returns focus to “Set status”; the same for “Actions” → “Delete”.

riasvdv and others added 2 commits November 12, 2026 14:26
Each row's delete button is now named after the row, as its selection
checkbox is, and deletion confirmations name the row or count the
selected rows instead of asking "Are you sure?". Custom messages still
take precedence.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d018-52fe-7115-873c-bc15563f0c5a
Co-authored-by: Amp <amp@ampcode.com>
[ci skip]

Amp-Thread-ID: https://ampcode.com/threads/T-01a1d018-52fe-7115-873c-bc15563f0c5a
Co-authored-by: Amp <amp@ampcode.com>
@github-actions

Copy link
Copy Markdown
Contributor

📚 Storybook previews

@craftcms/ui — open Storybook

No changed components detected in this Storybook.

resources/js — open Storybook

No changed components detected in this Storybook.

@riasvdv
riasvdv merged commit 561e83e into 6.x Nov 12, 2026
@riasvdv
riasvdv deleted the admin-table-delete-labels branch November 12, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant