Skip to content

Revisions: Ensure assertive announcements when exiting or restoring revisions #80036

Open
himanshupathak95 wants to merge 2 commits into
WordPress:trunkfrom
himanshupathak95:fix/77530-revisions-a11y-announcements
Open

Revisions: Ensure assertive announcements when exiting or restoring revisions #80036
himanshupathak95 wants to merge 2 commits into
WordPress:trunkfrom
himanshupathak95:fix/77530-revisions-a11y-announcements

Conversation

@himanshupathak95

@himanshupathak95 himanshupathak95 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What?

Part of #77530

Ensures that exiting the Revisions mode and restoring a revision trigger reliable, assertive screen reader announcements.

Why?

Previously, exiting or restoring revisions inconsistently announced confirmations. Restoring triggered a standard polite snackbar notification, which was frequently interrupted and dropped by screen readers due to focus shifting back to the main editor context. Furthermore, clicking "Exit" provided no explicit screen reader confirmation. Utilizing an assertive live region ensures users get immediate feedback that their action succeeded, regardless of underlying focus changes.

How?

  • Imported speak from @wordpress/a11y.
  • Added speak( __( 'Revisions exited.' ), 'assertive' ); to the onClick handler of the Revisions "Exit" button.
  • Added speak( message, 'assertive' ); in the restoreRevision action prior to creating the snackbar success notice.
  • Disabled the default polite spoken message on the resulting success notice (speak: false) to prevent redundant double announcements.

Testing Instructions

  1. Enable a screen reader.
  2. Open a post containing revisions in the block editor.
  3. Open the visual revision editor from the Document settings sidebar.
  4. Click the "Exit" button in the revisions header. Verify the screen reader announces "Revisions exited."
  5. Re-open the visual revisions editor.
  6. Drag the slider to select an older revision.
  7. Click the "Restore" button. Verify the screen reader assertively announces "Restored to revision from [Date]." without a duplicate announcement overlapping it.

Screenshots or screencast

Screen.Recording.2026-07-09.at.17.55.49.mov

@github-actions github-actions Bot added the [Package] Editor /packages/editor label Jul 9, 2026
@himanshupathak95
himanshupathak95 marked this pull request as ready for review July 9, 2026 12:29
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Editor.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

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: himanshupathak95 <abcd95@git.wordpress.org>

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

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

Labels

[Package] Editor /packages/editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant