Announce search suggestions for screen readers#85741
Conversation
Use useAccessibilityAnnouncement and useDebouncedAccessibilityAnnouncement hooks to announce result counts in SelectionList and suggestion counts in AutoCompleteSuggestions for screen reader users. Add translation keys for both English and Spanish. Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
|
Fixed the failing ESLint check: added the missing |
These keys were added to en.ts and es.ts but were missing from de, fr, it, ja, nl, pl, pt-BR, and zh-hans, causing typecheck failures. Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
|
Fixed the failing typecheck: added missing |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
src/languages/en.ts
Outdated
| noResultsFound: 'No results found', | ||
| noResultsFoundMatching: (searchString: string) => `No results found matching "${searchString}"`, | ||
| resultsAvailable: (count: number) => `${count} ${count === 1 ? 'result' : 'results'} available`, | ||
| suggestionsAvailable: (count: number) => `${count} ${count === 1 ? 'suggestion' : 'suggestions'} available`, |
There was a problem hiding this comment.
There was a problem hiding this comment.
Updated resultsAvailable and suggestionsAvailable to use the one/other plural translation object pattern across all language files. Also updated the call sites in BaseSelectionList and BaseAutoCompleteSuggestions to pass {count: N} instead of the count directly.
…gestionsAvailable Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
…ccessibility translations
The generateTranslations script's incremental mode cannot handle arrow function
wrappers like () => ({one: ..., other: ...}). Changed resultsAvailable and
suggestionsAvailable to use ({count}) => template string pattern instead, and
removed manual translations from non-English files to let the script generate them.
Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
|
Fixed the failing Root cause: The Fix: Changed Note: This trades CLDR plural form precision (separate singular/plural strings) for script compatibility. For screen reader accessibility announcements, this is acceptable — the count is always included in the string (e.g., "5 results available"). |
This comment has been minimized.
This comment has been minimized.
… all non-English language files Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
|
Fixed the failing typecheck: added missing Note: The Reassure performance test failure (render count deviation) appears unrelated to this PR's changes — it's an accessibility attribute addition, not a render behavior change. |
src/languages/en.ts
Outdated
| resultsAvailable: ({count}: {count: number}) => `${count} results available`, | ||
| suggestionsAvailable: ({count}: {count: number}) => `${count} suggestions available`, |
There was a problem hiding this comment.
Re-applied the one/other plural translation object pattern for resultsAvailable and suggestionsAvailable across all language files. The call sites already pass {count: N} from the earlier change.
|
The previously failing checks have already been resolved by the latest commit (
The only remaining failing check is |
|
The failing check ( Analysis: The 2 failing tests are in
This test file is not modified by this PR. The PR only changes Evidence: |
|
The failing check ( Analysis: The 2 failing tests are in Evidence:
|
…gestionsAvailable Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
The generateTranslations CI check auto-generates translations for non-English language files. The manually-added entries conflicted with this script, causing it to fail with "property exists but is not an object" error. Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
|
Fixed the failing Root cause: The Fix: Removed the manually-added |
…s to all language files Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
|
Fixed the failing typecheck: The |
|
The previously failing checks (TypeScript, Jest, and generateTranslations) were caused by missing or malformed All checks are now passing:
Only |
|
The failing Analysis: The failing test is Evidence: The exact same failure (same test, same 0.8 render count difference) is occurring on the completely unrelated PR branch A re-run of the perf-tests workflow should resolve this. I was unable to trigger the re-run due to permissions — please re-run it manually. |
|
The failing check is unrelated to this PR. Analysis: The only failing check is Evidence:
Re-running the workflow should resolve this. |
Code ReviewOverall this is a clean, well-structured PR. The approach of using mount/unmount Looks Good
Minor Nits (non-blocking)
|
|
The failing check ( Analysis: This PR only modifies TypeScript/translation files ( Evidence: Files changed vs failure location:
Recommendation: Re-run the failing check. If it fails again, this would be a pre-existing infrastructure issue. |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #74840 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
The failing check ( Analysis: The iOS build failed with Swift compilation errors in This is an Xcode/build environment issue, not related to the TypeScript and translation file changes in this PR. Evidence:
Re-running the failed check should resolve it. |
|
The failing check ( Analysis: This is a pre-existing iOS build infrastructure issue. The same Evidence: This PR only modifies TypeScript/JavaScript files ( |
|
@MelvinBot pull main. iOS build issue is fixed now |
…onsAccessibility Co-authored-by: Situ Chandra Shil <situchan@users.noreply.github.com>
|
Merged |
|
Ha and I was just retrying the failed action thinking it was just flaky. Let's see if it works now. |
|
🚧 @francoisl has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
Explanation of Change
This PR adds a screen reader announcement when address suggestions appear in the Settings > Profile > Address > Address line 1 input field, addressing WCAG 4.1.3 (Status Messages).
Changes:
AddressSearch: Uses the existinguseDebouncedAccessibilityAnnouncementhook to announce "Suggestions available" after a typing pause when the Google Places autocomplete dropdown becomes visible. This ensures screen reader users know that address suggestions have appeared.suggestionsAvailableto all language files.The hook leverages the existing
useAccessibilityAnnouncementinfrastructure which supports all platforms (web via hidden ARIA live region, iOS viaAccessibilityInfo.announceForAccessibilitywith delay, Android via the same API with opt-in).Fixed Issues
$ #74840
Tests
Offline tests
N/A — These are purely UI accessibility announcements that don't involve network requests.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A — Changes are accessibility attribute additions only (no visual UI changes).
Android: mWeb Chrome
N/A — Changes are accessibility attribute additions only (no visual UI changes).
iOS: Native
N/A — Changes are accessibility attribute additions only (no visual UI changes).
iOS: mWeb Safari
N/A — Changes are accessibility attribute additions only (no visual UI changes).
MacOS: Chrome / Safari
N/A — Changes are accessibility attribute additions only (no visual UI changes).