-
Couldn't load subscription status.
- Fork 235
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
Open
marissahuysentruyt
wants to merge
19
commits into
main
Choose a base branch
from
marissahuysentruyt/swc-274-tray-visually-hidden-bug
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+425
−4
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1977764
feat(tray): add dismissHelper function
marissahuysentruyt 4183066
refactor(tray): expand visually-hidden selector for dismiss buttons
marissahuysentruyt 1d36948
docs(tray): add tray docs with visually hidden dismiss
marissahuysentruyt 92fb18b
feat(dialog-base): add dismissHelper for visually-hidden buttons
marissahuysentruyt a1132bf
feat(dialog-wrapper): implement conditional dismissHelper buttons
marissahuysentruyt c96463d
feat(modal): add visually-hidden styles for dialog dismissHelpers
marissahuysentruyt 5420c21
revert: feat(modal): add visually-hidden styles for dialog dismissHel…
marissahuysentruyt 40834f4
revert: feat(dialog-wrapper): implement conditional dismissHelper but…
marissahuysentruyt 36dea1c
revert: feat(dialog-base): add dismissHelper for visually-hidden buttons
marissahuysentruyt 5d1e987
feat(tray): expand API for dismissible behavior
marissahuysentruyt 542fb4d
docs(tray): update README with new properties/examples
marissahuysentruyt dd07f22
test(tray): add tests for dismiss button detection
marissahuysentruyt 1dcd561
chore(tray): add changeset
marissahuysentruyt 8ca9b6a
chore(tray): fix type errors
marissahuysentruyt 08ff700
test(tray): fix failing close test
marissahuysentruyt 37c11cd
fix(tray): remove negative tabindex fromhidden buttons
marissahuysentruyt 4321b34
test(tray): add keyboard accessible test assertion
marissahuysentruyt 320f0d7
docs(tray): update docs with keyboard nav info
marissahuysentruyt 661de4a
test(tray): add tab and close() keyboard tests
marissahuysentruyt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| '@spectrum-web-components/tray': minor | ||
| --- | ||
|
|
||
| **Added**: Automatic dismiss button detection and visually-hidden helpers for screen reader accessibility | ||
|
|
||
| - **Added**: `<sp-tray>` now automatically detects keyboard-accessible dismiss buttons (like `<sp-button>`, `<sp-close-button>`, or HTML `<button>` elements) in slotted content | ||
| - **Added**: When no dismiss buttons are detected, the tray automatically renders visually-hidden dismiss buttons before and after its content to support mobile screen readers (particularly VoiceOver on iOS) | ||
| - **Added**: New `has-keyboard-dismiss` boolean attribute to manually override auto-detection when slotted content has custom dismiss functionality that cannot be automatically detected | ||
| - **Added**: Auto-detection recognizes `<sp-dialog dismissable>` and `<sp-dialog-wrapper dismissable>` components with built-in dismiss functionality in shadow DOM | ||
| - **Enhanced**: Improved mobile screen reader accessibility by ensuring dismissal options are always available when appropriate |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because tray-modal has a
tabindex="-1", I still can't get to the dismiss buttons with a keyboardThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if I'm still missing anything here. Without removing the
tabindex="-1"on the.tray.modal, I can still tab to the buttons.Screen.Recording.2025-10-24.at.2.11.49.PM.mov
Did we want some sort of focus indicator? What's the expectation if the button is visually hidden, but keyboard accessible? 🤔
