Skip to content

feat!: announce toasts via shared ARIA live region#9672

Open
mikeharv wants to merge 3 commits intoRaspberryPiFoundation:v13from
mikeharv:toast-live-region
Open

feat!: announce toasts via shared ARIA live region#9672
mikeharv wants to merge 3 commits intoRaspberryPiFoundation:v13from
mikeharv:toast-live-region

Conversation

@mikeharv
Copy link
Copy Markdown
Contributor

@mikeharv mikeharv commented Apr 1, 2026

The basics

The details

Resolves

Fixes #9667

Proposed Changes

This PR updates the Toast utility to use the shared announceDynamicAriaState() live region instead of managing its own aria-live region on each toast.

Changes include:

  • Removed role="status" and aria-live from the toast DOM element.
  • Added a call to announceDynamicAriaState() when a toast is shown.
  • Passed the toast message, status role, and configurable assertiveness to the shared live region.
  • Removed the Toast.Assertiveness enum and replaced usage with aria.LiveRegionAssertiveness.

Breaking Change

This work removes Blockly.Toast.Assertiveness. Users who have depended upon this will want to switch to the equivalent Blockly.utils.aria.LiveRegionAssertiveness.

Reason for Changes

Previously, each toast managed its own aria-live region. This could lead to duplicate or inconsistent screen reader announcements and duplicated ARIA logic across components.

Using the shared announceDynamicAriaState() utility centralizes live region management, ensures consistent announcement behavior, and aligns toast announcements with other dynamic ARIA announcements in Blockly.

Test Coverage

Tests were updated to reflect the new architecture:

  • Verified that toast messages are announced through the shared live region.
  • Verified that the live region is assigned the status role.
  • Verified that assertiveness defaults to polite and respects the assertiveness option when provided.
  • Verified that the toast element itself no longer has aria-live or role="status" to prevent duplicate announcements.

@mikeharv mikeharv requested a review from a team as a code owner April 1, 2026 15:02
@mikeharv mikeharv requested a review from BenHenning April 1, 2026 15:02
@github-actions github-actions bot added the PR: feature Adds a feature label Apr 1, 2026
Copy link
Copy Markdown
Collaborator

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @mikeharv! Changes look good though I do have one concern that will need to be addressed before this can be merged. PTAL.

@BenHenning BenHenning assigned mikeharv and unassigned BenHenning Apr 1, 2026
@mikeharv mikeharv changed the title feat: announce toasts via shared ARIA live region feat!: announce toasts via shared ARIA live region Apr 2, 2026
@github-actions github-actions bot added breaking change Used to mark a PR or issue that changes our public APIs. PR: feature Adds a feature and removed PR: feature Adds a feature breaking change Used to mark a PR or issue that changes our public APIs. labels Apr 2, 2026
@mikeharv mikeharv requested a review from BenHenning April 2, 2026 16:24
Copy link
Copy Markdown
Collaborator

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @mikeharv! No other concerns from me, this looks good!

@BenHenning BenHenning removed their assignment Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Used to mark a PR or issue that changes our public APIs. PR: feature Adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants