fix(picker): added helptext component under same shadow root for screen reader #5362
+29
−11
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.
Description
This PR addresses an accessibility issue where help text associated with sp-picker is not properly announced by screen readers. The problem occurs because help text elements (
sp-help-text
) outside the shadow DOM aren't correctly associated with the picker in the accessibility tree.The changes add proper ARIA relationships and support for slotting help text directly into the picker component.
Changes
Added a dedicated
help-text
slot tosp-picker
Related issue(s)
Motivation and context
Before
Previously, help text needed to be explicitly referenced by ID and wasn't being properly announced by screen readers:
After
Now developers can slot help text directly into the picker, and it will be properly announced by screen readers:
How has this been tested?
Test case 1
Test case 2
Did it pass in Desktop?
Did it pass in Mobile?
Did it pass in iPad?
Screenshots (if appropriate)
Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.