Skip to content

DataViews: Announce when bulk actions become available or unavailable - #87247

Open
HrithikDalal wants to merge 2 commits into
WordPress:trunkfrom
HrithikDalal:fix/dataviews-bulk-actions-announcements
Open

HrithikDalal wants to merge 2 commits into
WordPress:trunkfrom
HrithikDalal:fix/dataviews-bulk-actions-announcements

Conversation

@HrithikDalal

@HrithikDalal HrithikDalal commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What?

Part of #85052

DataViews now tells screen reader users when selecting items makes the bulk actions available, and when clearing the selection takes them away.

Why?

The bulk actions toolbar only shows up once something is selected, so there's nothing to find beforehand, and nothing says it appeared. Sighted users see the toolbar swap in; screen reader users get no signal.

How?

  • When the user changes the selection in the table or grid layout and that changes whether bulk actions show, DataViews says "Bulk actions available." or "Bulk actions no longer available." (polite).
  • The message goes out once the new selection has rendered. That's after the focus move from "Select all" or "Cancel" (DataViews: Move bulk selection focus only on request from an interaction #86932), which would otherwise cut it off, and it also covers consumers that keep the selection in the URL.
  • Only selection changes the user makes are announced. When the consumer clears the selection itself, e.g. after moving the items to the trash, nothing is said, so the notice for that action isn't cut off.
  • If the consumer doesn't take a change, nothing is said until it does, and a later change in the same direction is then announced. The message is still true at that point.
  • Like the footer, only the table and grid layouts count, since they're the ones with the toolbar.

In the extensible site editor, selecting a page changes the URL, and on trunk Boot announces the page title on every URL change, which replaces this message. #87221 limits that to path changes, so v2 needs it for this to be heard. The classic site editor works on trunk.

Testing Instructions

  1. Site Editor > Pages, table layout.
  2. Check a row's checkbox. The polite live region (#a11y-speak-polite) reads "Bulk actions available."
  3. Check a second row. Nothing new is announced.
  4. Uncheck both. It reads "Bulk actions no longer available."
  5. Use "Select all", then "Cancel" in the toolbar. Same two messages, after focus moves.
  6. Select a page and trash it. Only the trash notice is announced.
  7. Switch to the list layout and select an item. Nothing is announced, since there are no bulk actions there.

Testing Instructions for Keyboard

With a screen reader on, Tab to a row checkbox and press Space. You hear the checkbox state, then "Bulk actions available."

Use of AI Tools

Used Claude Code to co-author the fix. Reviewed and tested by me.

@github-actions github-actions Bot added the [Package] DataViews /packages/dataviews label Nov 23, 2026
@HrithikDalal
HrithikDalal force-pushed the fix/dataviews-bulk-actions-announcements branch from 49d4dd3 to 3c6bce9 Compare November 23, 2026 09:31
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: HrithikDalal <hrithikd@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

icon: blockTable,
viewConfigOptions: DensityPicker,
// Renders the bulk actions toolbar.
hasBulkActions: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VIEW_LAYOUTS is exported from the package, so this makes hasBulkActions public API. Can we keep the table/grid check internal, like the footer does in trunk? Then the changes in the layouts and the footer aren't needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, moved it back to an internal table/grid check like the footer. The layouts and the footer are untouched now.

@HrithikDalal
HrithikDalal force-pushed the fix/dataviews-bulk-actions-announcements branch from 3c6bce9 to a4d6a14 Compare November 27, 2026 09:04
@HrithikDalal
HrithikDalal force-pushed the fix/dataviews-bulk-actions-announcements branch from a4d6a14 to 62bb13a Compare December 3, 2026 16:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] DataViews /packages/dataviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants