-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
fix(ui): make LinkWithArrow behave like accessible button for modal open #8051
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(ui): make LinkWithArrow behave like accessible button for modal open #8051
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Pull Request Overview
This PR improves accessibility of the details button in the download releases table by making the LinkWithArrow component behave like a proper accessible button for modal opening. It addresses accessibility concerns by adding appropriate ARIA attributes and keyboard navigation support.
Key changes:
- Added proper button semantics with
role="button"
andtabIndex={0}
- Implemented keyboard support for Enter and Space key activation
- Enhanced screen reader support with
aria-label
apps/site/components/Downloads/DownloadReleasesTable/DetailsButton.tsx
Outdated
Show resolved
Hide resolved
There should be a way to do this without adding the additional listener, right? According to https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event, the "click" event is emitted on key press. |
Thank you for the suggestion, @avivkeller! 🙌
You're absolutely right — a manual listener isn’t needed if the element were a native Since To solve this while preserving the current structure, I added a Alternatively, I'm also exploring replacing the underlying element with a native Really appreciate your input — Please, Let me know 🙏 |
I'd rather convert it to an anchor or button, instead of adding redundant listeners |
+1 this should be an actual semantic button |
Hi @avivkeller @MattIPv4 👋 I've updated the implementation to use a This change improves accessibility and removes the redundant event listener. Let me know if anything else needs adjustment — happy to iterate! |
What if we, instead, change the LinkWithArrow component itself to be an |
Thanks for the suggestion!, @avivkeller 🙌
Changing
That’s why it’s more robust to use the appropriate semantic element ( |
Okay, so why don't we have it be a |
Hi @avivkeller 👋 I've updated the
Let me know if any further refinements are needed — happy to iterate! 🙌 |
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.
Almost there!
Hi @avivkeller ,
Yes, this can be done like this
but for that we have to refractor some files like
|
That's not what I meant, I meant the type definition itself. If it's not possible, forget it |
Hi @avivkeller 👋, Thanks for the clarification! I misunderstood your suggested approach.
Since you meant it’s fine to skip if not possible— I’ve kept the simpler & skip it. All other previous changes are applied as ✅ suggested above. Let me know if anything else is needed! |
@Mohit5Upadhyay May I push a commit to resolve some last minute things, then we are good to go? |
conflicts :P |
Signed-off-by: Aviv Keller <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8051 +/- ##
==========================================
+ Coverage 72.98% 73.01% +0.03%
==========================================
Files 95 95
Lines 8324 8324
Branches 215 214 -1
==========================================
+ Hits 6075 6078 +3
+ Misses 2248 2245 -3
Partials 1 1 ☔ View full report in Codecov by Sentry. |
…/github.com/mohit5upadhyay/nodejs.org into fix/8048-keyboard-accessible-details-button
Description
This PR solve the issue: #8048 by improving accessibility using
LinkWithArrow
as a button to trigger the modal with correctrole
,tabIndex
,aria-label
, and keyboard support.Validation
details-btn.mp4
Related Issues
Closes #8048
Check List
pnpm format
to ensure the code follows the style guide.pnpm test
to check if all tests are passing.pnpm build
to check if the website builds without errors.