fix(a11y): use native button in MetricsScoreCircle#3437
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughRenders a native HTML button when clickable and a non-interactive div otherwise; removes custom keyboard/ARIA handling; changes Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3437 +/- ##
=======================================
Coverage ? 85.57%
=======================================
Files ? 461
Lines ? 14236
Branches ? 1897
=======================================
Hits ? 12182
Misses ? 1679
Partials ? 375
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
Hey @kasya , I’ve updated the unit tests in MetricsScoreCircle.test.tsx to align with the new native button behavior. The keyboard interaction tests now use @testing-library/user-event instead of fireEvent to better reflect real user keyboard interactions (Enter and Space). This resolves the failing unit tests caused by the accessibility change. Please let me know if any further adjustments are needed. |
|
kasya
left a comment
There was a problem hiding this comment.
@Shubb07 thanks for working on this! 👍🏼
The tests were still failing (could be for a different reason).
I fixed that failing test 👌🏼
Going forward, please make sure to run make check-test every time before pushing changes. This helps catch linting issues and failing tests early.
|
Hey @kasya , Thanks a lot for the review and guidance! I’ll make sure to run make check-test before pushing changes going forward. Appreciate your help. |



Proposed change
Resolves #3421
This PR fixes a SonarCloud accessibility issue where a non-interactive
Non-native interactive elements should not be used with click and keyboard handlers, as this breaks semantic HTML and can cause accessibility issues. This change replaces the interactive div with a native when the component is clickable, while keeping a div for the non-interactive state.
This preserves the existing visual and functional behavior, improves keyboard and assistive-technology support, and resolves the SonarCloud rule typescript:S6848.
##Checklist