Repository navigation
Announce Badge as a single accessibility element - #100462
Conversation
Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
I created this PR from a branch on If you can't push to Then close this PR and open a new one from your fork. One thing to flag before this goes to review: the screen-reader behaviour has not been verified in a live browser. The web test session I was given was stuck on a blank page ( |
|
🤖 Web test steps verification results: Text-only badges (Members list) and the pressable badge ("Offer available!") both verify cleanly in Chrome's accessibility tree: exactly one node, named by the badge text, with no extra wrapper stop. Icon+text badges ("Unlock this feature" / "Done") could not be conclusively verified — their entire card region, including unrelated headings and paragraphs, is absent from the captured accessibility tree, so the icon-hidden/text-shown split can't be isolated from that apparent environment limitation. A workspace was created during the run to reach real view run · no recording available |
|
@codex review |
|
@MelvinBot review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
🤖 Code review Both fixes are correct, and I verified the platform claims against the pinned dependency source rather than taking the PR description's word for it. No blocking issues. Two minor comments, one verification gap, and the PR body still has What I verified
Useful framing the description doesn't state: both fixes are effectively web-only. Comments1. The third test's name promises more than it locks in — 2. Latent, not a regression: Verification gapThe web run confirmed the text-only and pressable cases but came back inconclusive on icon+text badges — which is precisely the one behavior this PR changes on web that nothing else covers. That inconclusive result was an accessibility-tree capture limitation (unrelated headings on the same screens were missing too), not evidence of a defect, and the source-level check above is stronger evidence than a snapshot would be. Still, a manual NVDA-in-Chrome or VoiceOver-in-Safari pass over the "Getting started → Done" row or a workspace upgrade card is the honest way to close it. I did not re-run the browser tester, since it would hit the same capture limit. Other notes
I'm not approving this — a human should sign off on the screen-reader behavior. view run · no recording available |
|
@MelvinBot pull main |
…yStop Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
Merged The branch was 3782 commits behind; it's now up to date with Verification after the mergeThe PR's own diff is unchanged — still just Local AI tests re-run against the merged tree:
The screen-reader behaviour this PR fixes still needs manual VoiceOver/NVDA verification — the merge doesn't change that. |
|
There is nothing to fix in code — the only failing check is a process gate, not a test.
It needs an approval from an eligible reviewer who is not a commit author on the PR. Since Every other check passes: I have not pushed anything, because no code change can satisfy this check. How I verified
One unrelated flag while you are here: the PR body still has the |
DetailsExplanation of ChangeA non-pressable
Result: one screen-reader stop, named by the badge text. Why this is not the "too broad" change from #93335: that PR removed Scope checks:
Fixed Issues$ #97269 Tests
Offline testsSame as Tests QA StepsSame as Tests
PR Author Checklist
@MelvinBot please set the PR body to the content in the details section above and mark as ready for review |
|
@aimane-chnaif Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Done — PR body replaced with the content you provided (verbatim) and the PR is now marked ready for review. One thing worth flagging: your version doesn't include the |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safaribefore: before.movafter: after.mov |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #97269 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
🚧 luacmartins 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! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.4.82-0 🚀
|
|
🤖 No help site changes required — so no draft PR was created. This PR changes only how the What I checkedDiff reviewed: Help site articles considered:
This fix makes already-documented behavior work correctly rather than changing it. Help site articles describe what users can do, not how many accessibility tree nodes a component emits. @aimane-chnaif, there is no help site PR to link because I found nothing in |
|
@luacmartins This is accessibility testing which is not inscope, could this be verified internally? |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.4.86-0 🚀
|
|
🤖 No help site changes are required — no draft PR created. This PR changes only how a non-pressable What I checked in
|
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.4.89-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.4.89-0 🚀
Bundle Size Analysis (Sentry): |










Explanation of Change
A non-pressable
Badgewas exposed to assistive tech as three separate stops (wrapper, icon, text) instead of one. Two web-only causes, both fixed insrc/components/Badge.tsx:role="presentation"andaria-label={text}on the same element.aria-labelis a global ARIA property, and per the ARIA spec a user agent must ignorerole="presentation"on an element carrying any global ARIA property. So the wrapper<div>was exposed as a generic element named e.g. "Default" — an extra stop on top of the text that already provides the name. The fix dropsaria-labelfor the non-pressable case, which letsrole="presentation"finally collapse the wrapper out of the tree.Iconhides itself withaccessibilityElementsHidden/importantForAccessibility, which are native-only — react-native-web never maps them toaria-hidden, so the icon's<svg>stayed in the accessibility tree. The fix putsaria-hiddenon the badge's icon container when the badge has text. One prop covers both platforms: RNW forwardsaria-hiddento the DOM (it's in RNW'sforwardedProps), and RN 0.86'sViewmaps it toaccessibilityElementsHidden+importantForAccessibility.Result: one screen-reader stop, named by the badge text.
Why this is not the "too broad" change from #93335: that PR removed
CONST.ROLE.PRESENTATIONand setaccessibleon every badge, which turns badges into announcement targets everywhere. This keeps the presentation role, leavesaccessibleuntouched, and only (a) removes a duplicate accessible name and (b) hides a decorative icon.Scope checks:
<Badge>call site that passesicon(GettingStartedRow,UpgradeIntroView,WorkspaceOwnerRestrictedAction,PaymentMethodListItem,UpgradeIntro,PerDiemFields,MenuItem, and the workspace table rows) also passestext, so the icon is decorative in every current usage and hiding it loses no information. Icon-only badges are deliberately left untouched —aria-hiddenis only applied when there is text to name the badge.accessible={false}, so its label was never exposed there.role="button"and theiraccessibilityLabel.getByTextqueries are unaffected — theTextnode is untouched.Fixed Issues
$ #97269
PROPOSAL: #97269 (comment)
Tests
Offline tests
Same as Tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, 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.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.