-
Notifications
You must be signed in to change notification settings - Fork 234
fix(tray): add visually hidden dismiss buttons #5814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(tray): add visually hidden dismiss buttons #5814
Conversation
|
📚 Branch Preview🔍 Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
Tachometer resultsCurrently, no packages are changed by this PR... |
Pull Request Test Coverage Report for Build 18664268679Details
💛 - Coveralls |
|
Description
This PR implements visually hidden dismiss buttons in the
<sp-tray>
component to improve mobile screen reader accessibility, particularly for VoiceOver on iOS. The dismiss buttons are automatically rendered before and after the tray's slotted content, allowing mobile screen reader users to easily dismiss the overlay from either end without requiring manual implementation by developers.Changes include:
dismissHelper
getter toTray.ts
that returns a visually hidden button template.visually-hidden
class for shadow DOM contentThe implementation follows the same pattern used in the
<sp-picker>
component, ensuring consistency across the design system.Motivation and context
Mobile screen reader users, particularly those using VoiceOver on iOS, navigate through interactive elements sequentially (by swiping). Without dismiss buttons at the beginning and end of tray content, users who navigate past all menu items have difficulty discovering how to close the overlay - they must either navigate backward through all items or close the app entirely.
This accessibility gap was identified during an accessibility audit and affects any tray usage with menu content that lacks a built-in dismiss mechanism.
Related issue(s)
Screenshots (if appropriate)
N/A - This is a non-visual accessibility enhancement. The dismiss buttons are visually hidden but accessible to screen readers.
Author's checklist
Reviewer's checklist
patch
,minor
, ormajor
featuresManual review test cases
Verify dismiss buttons are accessible to VoiceOver on Mac
Cmd + F5
)Control + Option + Right Arrow
Control + Option + Space
Verify dismiss buttons don't interfere with keyboard navigation
tabindex="-1"
)Verify dismiss buttons work with dialog content
Verify dismiss buttons are visually hidden
.visually-hidden
classDevice review
Note: Primary testing should be done with VoiceOver on iOS/iPadOS devices or simulators where the original accessibility issue was discovered.