-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Fix(NavBar, AvatarGroup): Improve keyboard accessibility for interactive controls #8416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix(NavBar, AvatarGroup): Improve keyboard accessibility for interactive controls #8416
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
👋 Codeowner Review RequestThe following codeowners have been identified for the changed files: Team reviewers: @nodejs/nodejs-website @nodejs/web-infra Please review the changes when you have a chance. Thank you! 🙏 |
avivkeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a way to do this without JavaScript onKeyDown? That seems like un-needed complexity
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8416 +/- ##
==========================================
- Coverage 73.64% 73.62% -0.03%
==========================================
Files 107 107
Lines 9161 9168 +7
Branches 312 312
==========================================
+ Hits 6747 6750 +3
- Misses 2412 2416 +4
Partials 2 2 ☔ View full report in Codecov by Sentry. |
|
@avivkeller |
| role="button" | ||
| tabIndex={0} | ||
| onKeyDown={e => { | ||
| if (e.key === 'Enter' || e.key === ' ') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm -1 of this change. I'm unsure of what you're trying to achieve here, but this menu is only visible on mobile screens, which very often are touch-only. Screen readers should already be accessible to this with aria-label, there's no need for an onKeyDown here.
|
|
||
| {avatars.length > limit && ( | ||
| <span | ||
| role="button" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can already navigate through avatars with tab without any of this. -1 to the change.
ovflowd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes feel misplaced. They feel like changes that were generated by AI without actually confirming if there were accessibility issues on said components or if they actually are pertinent for their use cases, likely a prompt such as "Check with components of this repository likely have accessibility issues not confirming with the ARIA format, especially missing keyboard navigations"
I could be wrong, but for a first-time contributor to know we have these docs and write changes directly on them, it's... Unlikely.
If the PR description and code feels like AI, quacks like AI and looks like AI, then it likely is.
That isn't a bad thing, I use AI all the time, but the issue is that these changes were likely not validated/tested against (before / after) nor screenshots showing these new changes.
I appreciate your efforts here, but I'm against this change.
Description
Improve keyboard accessibility and ARIA semantics across interactive UI:
This addresses WCAG 2.1 AA requirements for keyboard operability and proper roles/names while preserving existing visuals and pointer behavior.
Changes
packages/ui-components/src/Common/AvatarGroup/index.tsxrole="button"andtabIndex={0}to the “+N/–N” controlEnterandSpaceinonKeyDownto togglepackages/ui-components/src/Common/AvatarGroup/index.tsx:66packages/ui-components/src/Containers/NavBar/index.tsxtabIndex={0}andonKeyDownto the mobile menu label triggerEnter/Spacetoggles#sidebarItemTogglerpackages/ui-components/src/Containers/NavBar/index.tsx:53docs/creating-components.mdrole="button",tabIndex, and keyboard handlingdocs/creating-components.md(Accessibility subsection below “Responsive Design”)Validation
EnterorSpaceto expand/collapseEnterorSpaceto open/closearia-labelCheck List
pnpm formatto ensure the code follows the style guide.pnpm testto check if all tests are passing.pnpm buildto check if the website builds without errors.