fix: remove aria-selected on elements with role link#12766
Open
DilinaCP wants to merge 2 commits intoreact-navigation:mainfrom
Open
fix: remove aria-selected on elements with role link#12766DilinaCP wants to merge 2 commits intoreact-navigation:mainfrom
DilinaCP wants to merge 2 commits intoreact-navigation:mainfrom
Conversation
|
Hey @DilinaCP! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines. |
✅ Deploy Preview for react-navigation-example ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Author
|
The E2E failure seems unrelated to my changes. Could a maintainer please re-run the CI to confirm? Thanks! |
satya164
requested changes
Oct 5, 2025
Member
satya164
left a comment
There was a problem hiding this comment.
Thanks for the PR.
However, this doesn't seem to fix the linked issue. DrawerItem, TabBarItem, and BottomTabBarItem don't use Link, but PlatformPressable, and not Link.
The proper fix would be to conditionally set aria-selected on these based on whether href is undefined.
aria-selected={href ? undefined : isFocused}1573758 to
05ca74a
Compare
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.
Motivation
Currently, elements with
role="link"were being assigned thearia-selectedattribute, which is incorrect according to accessibility guidelines.aria-selectedis meant for elements in a selectable group (like tabs or list items) and should not appear on standard links.This PR removes the
aria-selectedattribute from elements withrole="link"to improve accessibility compliance and prevent screen readers from announcing misleading information.Fixes: #9418
Test Plan
Run all existing tests to ensure nothing breaks:
yarn test
Verify snapshots for Link component no longer include
aria-selectedfor role="link" elements.Manually check that web links still navigate correctly and styling remains unaffected.
Lint and TypeScript checks:
yarn lint
yarn tsc --noEmit
All tests pass, lint is clean, and types are valid.