Fix: Associate error message with form field for screen readers#82964
Conversation
|
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product 👍
|
@suneox, kindly bump. thanks. |
|
@suneox, quick bump. thanks. |
Sure I'll take a look at this one today |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppCleanShot.2026-03-11.at.21.16.27.2.mp4CleanShot.2026-03-15.at.22.54.53.3.mp4Android: mWeb ChromeCleanShot.2026-03-11.at.21.18.32.3.mp4CleanShot.2026-03-15.at.23.07.47.4.mp4iOS: HybridAppCleanShot.2026-03-11.at.20.56.23.1.mp4CleanShot.2026-03-15.at.22.41.45.1.mp4iOS: mWeb SafariScreenRecording_03-11-2026.21-30-08_1.1.mp4MacOS: Chrome / SafariCleanShot.2026-03-11.at.21.02.13.1.mp4CleanShot.2026-03-15.at.22.42.53.2.mp4 |
src/components/TextInput/BaseTextInput/implementation/index.tsx
Outdated
Show resolved
Hide resolved
|
@suneox, I've addressed your comments. Please take another look when you get a chance. thanks. |
|
@suneox, kindly bump. thanks. |
|
@suneox, quick bump. thanks. |
I’m starting to take a look at this one. |
|
@suneox I’ve updated the fix for Safari and re-tested it on the other platforms as well. It is now working as expected across all tested platforms. Video demo: error-announcemnt-safari.mov |
Great, I’ll take a look at this shortly. |
src/components/FormHelpMessage.tsx
Outdated
| /** Native ID applied to the message text when a direct text association is needed */ | ||
| messageNativeID?: string; |
There was a problem hiding this comment.
Have you got any reference we need to rename this prop?
| // This is workaround for https://github.com/Expensify/App/issues/47939: in case when user is using Chrome on Android we set inputMode to 'search' to disable autocomplete bar above the keyboard. | ||
| // If we need some other inputMode (eg. 'decimal'), then the autocomplete bar will show, but we can do nothing about it as it's a known Chrome bug. | ||
| const inputMode = inputProps.inputMode ?? (isMobileChrome() ? 'search' : undefined); | ||
| const accessibilityLabel = [label, hint, errorText ? translate('common.yourReviewIsRequired') : ''].filter(Boolean).join(', '); |
There was a problem hiding this comment.
Is this intended to remove the common.yourReviewIsRequired message?
There was a problem hiding this comment.
I did not restore the generic phrase because the final fix uses the actual error text on web, while native error announcement remains unchanged through the native implementation.
|
@codex review new update |
|
@marufsharifi The live error message functionality is broken after the new update. CleanShot.2026-03-14.at.15.29.02.1.mp4 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca42220e83
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const accessibilityLabel = [label, hint, errorText ? translate('common.yourReviewIsRequired') : ''].filter(Boolean).join(', '); | ||
| const inputNativeID = inputProps.nativeID ?? inputProps.id ?? inputID ?? `text-input-${helpMessageId}`; | ||
| const helpMessageTextID = `${helpMessageId}-text`; | ||
| const accessibilityLabel = inputProps.accessibilityLabel ?? [label, hint].filter(Boolean).join(', '); |
There was a problem hiding this comment.
Restore invalid cue in default accessibilityLabel
Removing translate('common.yourReviewIsRequired') from the default accessibilityLabel regresses native screen-reader behavior when a field has errorText: on iOS/Android, the new aria-errormessage/aria-invalid attributes are not what gets announced, so refocusing an invalid input no longer conveys that it is in an error state (previously it always did via the label). This especially affects repeated navigation back to the same field after validation errors.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
the PR change is in the web implementation and native still has its own path
|
@marufsharifi Please review the comments above and including this one. |
|
@suneox I’ve updated the fix based on the latest comments and re-tested it across the affected platforms. Current result:
Please take another look when you have a chance. safari-error-announcement.mov |
|
@suneox could you please re-review when you have a chance? |
@marufsharifi How about your validation on the native platform? Is the error message associated when the input is focused? CleanShot.2026-03-15.at.18.07.11.1.mp4 |
|
@suneox yes, on native the error is associated and announced when the screen-reader focus moves back to the input. For this case, the relevant validation is VoiceOver focus, not just tapping/clicking the field. On the simulator, please move the VoiceOver focus to the input using |
|
@suneox video demo of test on iOS native Screen.Recording.2026-03-15.at.4.17.09.PM.mov |
It work for me, I've updated screenshot |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #76939 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
🚧 @yuwenmemon has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.3.38-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.38-4 🚀
|
Explanation of Change
When a field has an error, we now explicitly connect the visible error message to that input using accessibility attributes. As a result, screen readers can announce both that the field is invalid and what the error is when users focus the field.
Fixed Issues
$ #76939
PROPOSAL: #76939 (comment)
Tests
Offline tests
Same as Tests.
QA Steps
Same as Tests.
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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
Screen.Recording.2026-02-24.at.8.51.07.PM.mov
Android: mWeb Chrome
Screen.Recording.2026-02-24.at.8.54.32.PM.mov
iOS: Native
Screen.Recording.2026-02-24.at.8.41.52.PM.mov
iOS: mWeb Safari
Screen.Recording.2026-02-24.at.8.44.59.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-02-23.at.7.02.36.PM.mp4