Repository navigation
fix(docs): make code blocks reachable and readable by keyboard and screen reader - #49562
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughCode blocks now use accessible language and line-count labels, a focusable scroll container, pinned controls, live wrap-state announcements, and updated wrapped-code overflow styling. ChangesCode block accessibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized documentation accessibility change is merge-ready after normal checks and review; no actionable merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the defects, solution, issue reference, and manual testing results. It does not include the required CONTRIBUTING.md acknowledgment or the template headings, but it provides the required change context in equivalent sections. Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
eb47238 to
ef8b856
Compare
…reen reader
The code block scroll container had no tabindex, so a keyboard-only user could
not reach it to scroll code that runs off the edge. Two further defects turned
up alongside it. axe reports zero violations here both before and after, so none
of this was caught by the automated suite.
Keyboard:
- Split the scroll region out of the positioning container. The controls were
absolutely positioned inside the element that scrolls, so `right-2` measured
against the scrollable content box and dragged them out of the corner.
- Give the scroll region a tabindex and a focus ring.
- Reveal the controls on group-focus-within, so focusing the block shows them
instead of waiting for a button to take focus.
Screen reader:
- Name the region "<language>, <n> lines", so a summary is announced on arrival
and the group can be skipped or stepped into. Fence aliases map to spoken
names, so `ts` announces as TypeScript rather than "tee ess".
- aria-hidden the line-number gutter. A block linearized as "1import
{ createClient } from '@supabase/supabase-js'23const supabase = ...", with
lines 2 and 3 collapsing into "23".
- Order the controls after the code, so the block is named before its actions.
- Announce the word wrap toggle through a live region, matching the copy button.
- Opt both buttons out of Radix's generated description, which repeated the
accessible name as "Copy code, button, Copy code".
Also move the data-wrapped side effect out of the setIsWrapped updater, since
React calls updaters twice under StrictMode.
1aeea7f to
972b0b0
Compare
dnywh
left a comment
There was a problem hiding this comment.
Tested as per instructions. Approving despite VoiceOver not announcing the full code block contents, as discussed elsewhere.
…for-pitr-archiving-stale * origin/master: (26 commits) chore(docs): add Simon Tomlinson to humans.txt (#49547) fix(docs): make code blocks reachable and readable by keyboard and screen reader (#49562) feat: update mgmt api docs (#49128) fix: display request body Array<object> schema/fields in Management API Reference (#49575) Set up feature preview for explorer (#49602) docs(troubleshooting): add postgres_changes not delivering guide (#48997) chore: Update API types (#49598) refactor(studio): fetch MCP tool→FGA map from mgmt-api endpoint (#49225) Add go page: Postgres Summit US 2026 contest (#49597) Add Lingo.dev customer case study (#49595) fix(studio): hide legacy API keys on High Availability projects (#49552) [FE-4246] fix(studio): resolve notebook database labels (#49554) fix(studio): resolve dirty notebook save conflicts (#49540) fix(studio): make menu links reliable (#49584) [FE-3717] feat(studio): Multigres cluster topology diagram (#49298) feat(www): homepage json-ld, canonical, 404 links (#49533) refine role impersonation popover (#49467) feat(studio): move read replica creation to a dialog (#49516) fix(www): pricing table spacing and sticky offset (#49532) fix(studio): treat region flags as decorative by default (#49574) ...
Closes DOCS-1283
CleanShot.2026-08-25.at.15.14.53.mp4
Problem
Three defects in the docs code block:
tabindex. On/guides/database/tables, 18 blocks, none focusable, 2 overflowing at 1280px. Tab skips the scroll region, so a keyboard-only user cannot scroll code that runs off the edge.role="group"with no accessible name, so it announces as bare "group".aria-hidden, so digits are read inline with the code. A block linearizes as1import { createClient } from '@supabase/supabase-js'23const supabase = ..., with lines 2 and 3 collapsing into "23".Four more surfaced while testing the fix:
right-2measured against the scrollable content box. Scrolling dragged them out of the corner into the middle of the code. This one predates the PR.focus-withinonly fired for the buttons, so focusing the block left the controls invisible.aria-labelidentical to their tooltip text, and Radix pointsaria-describedbyat the tooltip on focus, producing "Copy code, button, Copy code".Solution
Keyboard:
tabIndexand a focus ring.group-focus-within.Screen reader:
<language>, <n> lines. Code content stays readable; the summary goes in the name so the group can be skipped or stepped into.tsannounces as TypeScript. Only the ambiguous ones;bash,python,kotlin,dart,swiftalready read fine.aria-hiddenthe gutter. The numbers are alreadyselect-none, and copy takes its content from the source string rather than the DOM, so copy behavior is unchanged.Also moved the
data-wrappedside effect out of thesetIsWrappedupdater, since React calls updaters twice under StrictMode.Manual testing
/docs/guides/database/tables.document.querySelectorAll('.code-scroll[tabindex="0"]').lengthin the console. Expect18.[...document.querySelectorAll('.code-scroll')].map(b => b.getAttribute('aria-label')). Expect entries likeSQL, 11 linesandbash, 2 lines, plus one bare2 linesfor the fence with no language.Summary by CodeRabbit
Accessibility
Usability