-
Notifications
You must be signed in to change notification settings - Fork 5
Add ARIA live region for screen reader announcements of search results #448
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: next
Are you sure you want to change the base?
Conversation
Co-authored-by: tnaum-ms <[email protected]>
… better readability Co-authored-by: tnaum-ms <[email protected]>
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.
Pull request overview
This PR adds screen reader accessibility for search results in the CollectionView webview to comply with WCAG 4.1.3 (Status Messages). Previously, screen readers did not announce query results counts or "No Results Found" status, leaving users with assistive technology without feedback when queries completed.
Changes:
- Captures
documentCountfrom query responses for accessibility announcements - Adds ARIA live region with proper attributes for screen reader announcements
- Implements helper function with singular/plural handling for result announcements
- Adds
.sr-onlyutility class for visually-hidden but screen-reader-accessible content - Marks decorative
ProgressBarwitharia-hidden={true}to prevent redundant announcements
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/webviews/documentdb/collectionView/CollectionView.tsx | Adds state for document count, captures it from query responses, implements announcement helper, and adds ARIA live region for screen reader announcements |
| src/webviews/documentdb/collectionView/collectionView.scss | Adds .sr-only utility class for visually-hidden, screen-reader-accessible content |
| l10n/bundle.l10n.json | Adds localized strings for result announcements: "No results found", "1 result found", and "{0} results found" |
| .then((_response) => { | ||
| .then((response) => { | ||
| // Capture document count for accessibility announcements | ||
| setDocumentCount(response.documentCount); |
Copilot
AI
Jan 14, 2026
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.
The documentCount is set in the .then() block but not cleared in the .catch() or .finally() blocks. If a query fails, the live region will continue to announce the previous query's results. Set documentCount to undefined in the .catch() block to prevent stale announcements after errors.
| <div role="status" aria-live="polite" aria-atomic="true" className="sr-only"> | ||
| {getResultsAnnouncement()} | ||
| </div> |
Copilot
AI
Jan 14, 2026
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.
The ARIA live region is rendered unconditionally and always present in the DOM. While this works correctly, best practice for live regions is to keep them persistent in the DOM (which this does), so this implementation is correct. However, the live region will announce results on every query including pagination. For pagination (where executionIntent is 'pagination'), users may not want repeated announcements of the same count. Consider conditionally suppressing announcements during pagination by checking currentContext.activeQuery.executionIntent in getResultsAnnouncement().
Screen readers were not announcing search results count or "No Results Found" status, violating WCAG 4.1.3 (Status Messages). Users relying on assistive technology had no feedback when queries completed.
Changes
CollectionView.tsx
documentCountfromrunFindQueryresponse (previously discarded)role="status"andaria-live="polite"for non-intrusive announcementsgetResultsAnnouncement()helper with proper singular/plural handlingProgressBarwitharia-hidden={true}to prevent redundant announcementscollectionView.scss
.sr-onlyutility class for visually-hidden, screen-reader-accessible contentExample
Screen readers now announce "X results found", "1 result found", or "No results found" when queries complete, without visual changes to the UI.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.