Skip to content

Commit 1873f98

Browse files
authored
A11Y: Hide avatar link from tabindex when it's aria-hidden (#36227)
When paired with a username, we hide the avatar link from assistive technology because it's a decorative image wrapped in a duplicate link. We don't change the tabindex though, which means it's still reachable with tab navigation... and in this situation a screenreader may still announce it. <img width="300" alt="image" src="https://github.com/user-attachments/assets/9ff60992-8956-4b96-89a7-e3c1a5f6ec59" /> This adds tabindex `-1` when `ariaHidden` to remove it from tab nav so it's no longer an issue.
1 parent 15e8a80 commit 1873f98

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

frontend/discourse/app/components/user-link.gjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export default class UserLink extends Component {
6060
data-user-card={{this.username}}
6161
aria-hidden={{this.ariaHidden}}
6262
aria-label={{this.ariaLabel}}
63+
tabindex={{if this.ariaHidden "-1" "0"}}
6364
>
6465
{{yield}}
6566
</a>

0 commit comments

Comments
 (0)