feat: add keyboard accessibility to TOC toggle
Description
Fixed keyboard accessibility issue in the TOC component by replacing non-semantic
Replaced a non-semantic clickable container with a semantic 🎯 2 (Simple) | ⏱️ ~10 minutes 🐰 I swapped a div for a button bright, ✏️ Tip: You can configure your own custom pre-merge checks in the settings.📝 Walkthrough
Walkthrough
<button> in the TOC header, moved the toggle onClick to that button, and added aria-expanded and aria-label; content visibility remains controlled by the component's open state. (48 words)Changes
Cohort / File(s)
Summary
Accessibility refactor
components/TOC.tsxReplaced a div-based toggle with a semantic
button; moved onClick to the button; added type="button", aria-expanded, and aria-label; changed header text container from h5 to span; adjusted surrounding markup to wrap header and chevron in the button; preserved content visibility logic.Estimated code review effort
Poem
Now keyboard hops feel just right,
aria labels sing,
Chevrons dance and ring,
Accessibility takes flight ✨🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name
Status
Explanation
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
✅ Passed
The title 'feat: add keyboard accessibility to TOC toggle' clearly and concisely summarizes the main change—implementing keyboard accessibility for the TOC toggle component.
Linked Issues check
✅ Passed
The changes fully address all coding requirements from issue
#4972: replaced div with semantic button element, made it focusable, added aria-expanded and aria-label attributes, and maintained existing styles.
Out of Scope Changes check
✅ Passed
All modifications in TOC.tsx are directly related to implementing keyboard accessibility for the TOC toggle, with no unrelated or out-of-scope changes present.
Docstring Coverage
✅ Passed
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
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 @coderabbitai help to get the list of available commands and usage tips.
Deploy Preview for asyncapi-website ready!
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | e875be1216fd4c647f8d843a676a1cb27bc1e6db |
| Latest deploy log | https://app.netlify.com/projects/asyncapi-website/deploys/697b7ee26d7d1f00087a81b7 |
| Deploy Preview | https://deploy-preview-4973--asyncapi-website.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
⚡️ Lighthouse report for the changes in this PR:
| Category | Score |
|---|---|
| 🔴 Performance | 37 |
| 🟢 Accessibility | 98 |
| 🟢 Best practices | 92 |
| 🟢 SEO | 100 |
| 🔴 PWA | 33 |
Lighthouse ran on https://deploy-preview-4973--asyncapi-website.netlify.app/
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 100.00%. Comparing base (35abd54) to head (e875be1).
Additional details and impacted files
@@ Coverage Diff @@
## master #4973 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 796 796
Branches 146 146
=========================================
Hits 796 796
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@princerajpoot20 sir can you please have a look