fix(docsearch-react): add aria-hidden to SearchIcon and add accessible label to SearchBox input#2193
Merged
francoischalifour merged 5 commits intoalgolia:mainfrom Feb 28, 2024
Conversation
|
| Name | Link |
|---|---|
| 🔨 Latest commit | b22fef7 |
hbuchel
commented
Feb 26, 2024
| } | ||
|
|
||
| describe('api', () => { | ||
| let container: HTMLDivElement; |
Contributor
Author
There was a problem hiding this comment.
It doesn't look like we're using container anywhere besides in the before/afterEach? So I removed them.
shortcuts
reviewed
Feb 26, 2024
Member
shortcuts
left a comment
There was a problem hiding this comment.
awesome, thanks a lot for taking the time to improve DocSearch
francoischalifour
approved these changes
Feb 27, 2024
Contributor
francoischalifour
left a comment
There was a problem hiding this comment.
Thank you @hbuchel!
Could you please slightly increase the bundle size thresholds?
{
"files": [
{
"path": "packages/docsearch-css/dist/style.css",
- "maxSize": "3 kB"
+ "maxSize": "3.25 kB"
},
{
"path": "packages/docsearch-react/dist/umd/index.js",
- "maxSize": "22.80 kB"
+ "maxSize": "23 kB"
},
{
"path": "packages/docsearch-js/dist/umd/index.js",
- "maxSize": "30.70 kB"
+ "maxSize": "31 kB"
}
]
}
Contributor
Author
Updated, thanks! |
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.
There are 2 main changes in this PR:
aria-hiddento the SearchIcon so it can be hidden to assistive tech users. The unlabelled SVG can be accessed by screenreaders and can also get caught by automated accessibility audits. Since it's decorative, we can safely hide it witharia-hidden="true"in<SearchBox />and<SearchButton />searchInputLabel, to the search form's input. Currently the<input />is associated with a<label>that does not have an accessible label, only an unlabelled SVG as a child element. This PR adds accessibly hidden text within the<label>. I opted to use visually hidden text (using CSS to hide the text but still make it available for assistive tech users) for the label text because it's generally a better practice than reaching foraria-label.Additionally, this PR:
searchInputLabel