Improve Toast accessibility and clean up stories#22978
Merged
Conversation
Pull Request Test Coverage Report for Build 501b17bb426179b3391e988460284e2d027dde5dDetails
💛 - Coveralls |
…st-focus-managment
vraja-pro
reviewed
Feb 20, 2026
| > | ||
| <span className="yst-sr-only">{ dismissScreenReaderLabel }</span> | ||
| <XIcon className="yst-h-5 yst-w-5" /> | ||
| <XIcon className="yst-h-5 yst-w-5" aria-hidden="true" /> |
Contributor
There was a problem hiding this comment.
Actually we can use here the hook useSvgAria to get the svg props which includes the aria-hidden. We should also fix that in packages/ui-library/src/elements/modal-notification/index.js.
Contributor
Author
There was a problem hiding this comment.
Good point. I'll implement it
… Toast components to enhance accessibility features.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
sr-onlyspan for its accessible label, which is less robust than usingaria-label. Additionally, the Complex layout story demonstrated interactive patterns (confirm/dismiss buttons) that contradict the Toast's purpose as a non-interactive, informational component.Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
sr-onlyspan witharia-labelon the button and addedaria-hidden="true"on the XIcon. This is more robust and follows the standard pattern for icon-only buttons.ModalNotification, not in the non-modal Toast.Toast.Closedocs now recommend usingModalNotificationfor interactive notifications.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
yarn workspace @yoast/ui-library storybook).aria-label="Dismiss"and the XIcon should havearia-hidden="true".Toast.Closedocumentation should mention that toasts are non-interactive and recommendModalNotificationfor interactive use cases.Relevant test scenarios
Check the console for any React warnings or errors.
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Toast.Closesub-component — any place in the plugin that usesToast.Closeshould still work correctly (only the accessible label implementation changed, not the behavior).Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.[yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached theGoogle Docs Add-onlabel to this PR.Documentation
Quality assurance
grunt build:imagesand commited the results, if my PR introduces new images or SVGs.Innovation
innovationlabel.Fixes #1037