Skip to content

DataViews: Accessibility follow-ups from the bulk actions review - #86150

Closed
HrithikDalal wants to merge 26 commits into
WordPress:trunkfrom
HrithikDalal:fix/dataviews-a11y-follow-ups
Closed

HrithikDalal wants to merge 26 commits into
WordPress:trunkfrom
HrithikDalal:fix/dataviews-a11y-follow-ups

Conversation

@HrithikDalal

@HrithikDalal HrithikDalal commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #85052

Fixes the follow-ups from Joe's review of #82730. One commit per item, so it's easy to split if that's preferred.

Why?

Each item makes DataViews harder to use with a keyboard, a screen reader, or a magnifier. Details are in #85052.

How?

  1. Selection checkbox labels: they now say "Select [title]", like the list tables.
  2. Bulk action announcements: "Bulk actions available." when selecting the first item, and "Bulk actions no longer available." when the user clears the selection. Only selection changes the user makes are announced. When the app clears the selection itself, e.g. after a trash, nothing is said, so the trash notice isn't cut off.
  3. Focus after Trash: when the focused control is removed (the row's Actions button after a trash, for example), focus moves to "Select all", or to the first control of the layout if there's no checkbox.
  4. Trash confirmation announcement: in the extensible site editor, removing the trashed post from the URL counted as a route change, so "Pages" was announced. speak() clears every live region, so that wiped the trash notice. The route title is now only announced when the path changes.
  5. Dialog triggers: buttons and menu items for RenderModal actions get aria-haspopup="dialog". Quick Edit opens its modal from a callback, so I added an optional opensDialog flag to actions and set it on Quick Edit in both site editors. I left out aria-controls: the dialog only exists once it's open, and by then it covers the button.
  6. Cancel button: the close icon is now a "Clear selection" text button, and it sits right after the actions instead of at the far end of the toolbar.
  7. Thumbnails in the table: when the title next to the thumbnail is clickable, the thumbnail is out of the tab order and hidden from screen readers, so the cell no longer repeats the title. When the thumbnail is the only clickable control, it now has a focus ring. I didn't touch the grid: its thumbnail already takes its name from the visible title, and a test covers that on purpose.
  8. Author avatars: alt="", since the name is right next to the avatar.
  9. List items: each row was named after all of its content ("About us Edit Actions Status Draft"). It's now labelled by the title, and the fields stay as the item's description.
  10. Checkbox contrast over images: grid checkboxes get a ring in the surface color, so they stand out on any preview. The picker grid gets the same.
  11. Quick Edit image replacement: hovering or focusing the preview now shows a "Replace" hint in the bottom corner of the image. It's aria-hidden, since the preview's label already says "Replace [title]".

Testing Instructions

Site Editor → Pages, with a few pages (one with a featured image helps).

  1. Table layout: row checkboxes read "Select [title]" in the accessibility tree.
  2. With a screen reader on, check a row. You should hear "Bulk actions available." Uncheck it and you should hear "Bulk actions no longer available."
  3. Open a row's Actions menu and choose Move to trash, then confirm. Focus lands on "Select all", not the page body.
  4. With the gutenberg-extensible-site-editor experiment on, select a page, then trash it. The "moved to the trash" notice is announced and isn't replaced by "Pages".
  5. The Trash and Quick edit buttons have aria-haspopup="dialog".
  6. Select a page. A "Clear selection" button shows next to the bulk actions and clears the selection.
  7. With a featured image in the table, Tab goes straight from the checkbox to the title link, not to the thumbnail first.
  8. The author column doesn't announce "Author avatar".
  9. Switch to the list layout. Each row is named by its title only.
  10. Switch to the grid layout and hover a card whose image is dark or blue. The checkbox stands out.
  11. Open Quick edit on a page with a featured image and hover the image. A "Replace" hint shows in the bottom corner of the image.

Testing Instructions for Keyboard

  1. Tab to a row's Actions button, press Enter, choose Move to trash and confirm. Focus moves to "Select all".
  2. Check a row with Space, then Tab to "Clear selection" and press Enter. The selection clears.

Screenshots or screencast

Bulk actions Quick edit
after-toolbar after-quick-edit

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Co-authoring the fix. Reviewed and tested by me.

Copilot AI balanced review requested due to automatic review settings November 2, 2026 04:12
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 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>
Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org>
Co-authored-by: dinhtungdu <dinhtungdu@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 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.

@github-actions github-actions Bot added [Package] Editor /packages/editor [Package] Edit Site /packages/edit-site [Package] Media Utils /packages/media-utils [Package] DataViews /packages/dataviews [Package] Fields /packages/fields [Package] Boot /packages/boot labels Nov 2, 2026

Copilot AI left a comment

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.

🟡 Changes recommended

Unresolved accessibility issues cause incorrect bulk-action announcements, empty list-row names, missing forced-colors focus indicators, and failed focus recovery after item removal.

6 open issues
What changed in this PR

Addresses the accessibility follow-ups in #85052, building on the DataViews bulk-action toolbar work in #82730.

Changes:

  • Improves selection labels, bulk-action announcements, dialog semantics, and focus recovery.
  • Reduces repeated screen-reader content and improves thumbnail focus, checkbox contrast, and media replacement cues.
  • Updates tests, documentation, and changelogs for the revised behavior.
File Description
test/​e2e/​specs/​site-editor/​page-list.spec.js Updates the clear-selection button lookup.
routes/​post-list/​stage.tsx Marks extensible-editor Quick Edit as opening a dialog.
packages/​media-utils/​src/​components/​media-edit/​test/​index.jsdom.test.tsx Tests the replacement hint and accessible label.
packages/​media-utils/​src/​components/​media-edit/​style.scss Styles the replacement hint.
packages/​media-utils/​src/​components/​media-edit/​index.tsx Adds a visual “Replace” hint.
packages/​media-utils/​CHANGELOG.md Records the media replacement enhancement.
packages/​media-fields/​src/​author/​view.tsx Makes the adjacent author avatar decorative.
packages/​media-fields/​CHANGELOG.md Records the avatar accessibility change.
packages/​editor/​src/​components/​post-revisions-timeline/​author-field.tsx Makes revision author avatars decorative.
packages/​edit-site/​src/​components/​dataviews-actions/​index.js Marks classic-editor Quick Edit as opening a dialog.
packages/​dataviews/​src/​utils/​get-action-popup.ts Determines dialog-trigger semantics for actions.
packages/​dataviews/​src/​types/​dataviews.ts Adds the optional opensDialog action property.
packages/​dataviews/​src/​hooks/​use-focus-fallback.ts Adds focus recovery when controls disappear.
packages/​dataviews/​src/​dataviews/​test/​dataviews.jsdom.test.tsx Covers announcements, labels, and dialog semantics.
packages/​dataviews/​src/​dataviews/​test/​bulk-selection.browser.test.tsx Adds removal-related focus coverage and updates labels.
packages/​dataviews/​src/​dataviews/​index.tsx Announces changes in bulk-action availability.
packages/​dataviews/​src/​components/​dataviews-selection-checkbox/​index.tsx Prefixes item checkbox labels with “Select”.
packages/​dataviews/​src/​components/​dataviews-layouts/​utils/​item-click-wrapper.tsx Allows an explicit tab index.
packages/​dataviews/​src/​components/​dataviews-layouts/​table/​style.scss Adds a thumbnail focus indicator.
packages/​dataviews/​src/​components/​dataviews-layouts/​table/​column-primary.tsx Hides redundant thumbnail controls from keyboard and screen-reader navigation.
packages/​dataviews/​src/​components/​dataviews-layouts/​picker-grid/​style.scss Adds a contrasting checkbox ring.
packages/​dataviews/​src/​components/​dataviews-layouts/​list/​index.tsx Labels rows by title and marks dialog triggers.
packages/​dataviews/​src/​components/​dataviews-layouts/​grid/​style.scss Adds a contrasting checkbox ring over previews.
packages/​dataviews/​src/​components/​dataviews-layout/​index.tsx Attaches focus recovery to the layout container.
packages/​dataviews/​src/​components/​dataviews-item-actions/​index.tsx Marks item actions that open dialogs.
packages/​dataviews/​src/​components/​dataviews-bulk-actions/​style.scss Removes far-edge placement of the clear button.
packages/​dataviews/​src/​components/​dataviews-bulk-actions/​index.tsx Adds dialog semantics and a “Clear selection” text button.
packages/​dataviews/​README.md Documents opensDialog.
packages/​dataviews/​CHANGELOG.md Records the DataViews accessibility changes.
packages/​core-fields/​src/​post_type_supports/​author/​view.tsx Makes post author avatars decorative.
packages/​core-fields/​src/​attachment/​author/​view.tsx Makes attachment author avatars decorative.
packages/​boot/​src/​components/​app/​use-route-title.ts Avoids route-title announcements for search-only navigation.
packages/​boot/​src/​components/​app/​test/​use-route-title.jsdom.test.ts Tests path and search navigation announcements.
packages/​boot/​package.json Adds dependencies for the new hook tests.
packages/​boot/​CHANGELOG.md Records the route-announcement fix.
package-lock.json Synchronizes boot’s test dependencies.

Review effort: Balanced

Copilot AI left a comment

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.

🔵 Needs a closer look

The focus fallback leaves keyboard focus on document.body when the last visible item is removed and can unexpectedly return focus to Select all after the user deliberately leaves the layout.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Clear stale row focus when focus leaves the layout

packages/​dataviews/​src/​hooks/​use-focus-fallback.ts:66

Moving focus from a row to Search leaves lastFocused pointing at the row because this handler returns for any relatedTarget; if the user then clicks non-interactive content before filtering removes that row, the observer unexpectedly moves focus back to Select all. Clear the tracked control when focus deliberately leaves the layout for a non-modal control, while preserving modal/menu hand-offs.

Medium severity Restore focus to a persistent control when the layout becomes empty

packages/​dataviews/​src/​hooks/​use-focus-fallback.ts:102

When the last remaining item (or the last item matching the current filter) is trashed, the layouts render only empty, so this branch has no future control to focus and leaves keyboard focus on document.body. Add a final fallback to a persistent DataViews control outside the layout, such as Search or View options, rather than only waiting for another layout mutation.

6 resolved since last review

Review effort: Balanced

Copilot AI left a comment

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.

🟡 Changes recommended

The empty-state fallback leaves a deleted row control tracked after focusing Search outside the container, allowing later mutations to unexpectedly pull focus back to Search.

1 open issue

Review effort: Balanced

Forget the focused control once focus moves on to another one, including a fallback outside the layout. Keep it while a menu, dialog or popover opened from the layout has focus, but not the dialog the whole view is in. Bring focus back to a control that is still there once loading ends, leave the items infinite scroll unloads alone, and fall back to the controls around a picker too.

Copilot AI left a comment

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.

🟡 Changes recommended

The infinite-scroll exemption skips focus recovery for removed controls, leaving keyboard users on the document body when an action removes its focused trigger.

1 open issue
1 resolved since last review

Review effort: Balanced

… off screen

Tell unloading apart from an action removing the focused item by whether the item was on screen, measured against the scroll container with a margin and ignoring sideways scrolling. Also forget a control hidden on its own, such as the table media, once focus leaves it, refocus without scrolling, and name list rows by their content when the title is empty.

Copilot AI left a comment

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.

🟡 Changes recommended

The focus fallback still admits aria-disabled card checkboxes, so removing a focused card can move focus to an unusable control.

1 open issue
1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

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.

🔵 Needs a closer look

The document-wide focus-restoration changes span overlays, loading, and virtualized layouts, requiring integrated native keyboard and screen-reader validation unavailable in this review.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@ntsekouras

Copy link
Copy Markdown
Contributor

Thanks for the PR @HrithikDalal! Can you please split this in smaller ones per follow up task?

@HrithikDalal

Copy link
Copy Markdown
Contributor Author

Thanks @ntsekouras, makes sense. I'll split it into smaller PRs, one per follow-up task, and link them here.

@HrithikDalal

Copy link
Copy Markdown
Contributor Author

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

Labels

[Package] Boot /packages/boot [Package] DataViews /packages/dataviews [Package] Edit Site /packages/edit-site [Package] Editor /packages/editor [Package] Fields /packages/fields [Package] Media Utils /packages/media-utils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataViews and Quick Edit: improve selection labels, focus handling, and accessible names

3 participants