Skip to content

Fix axe scrollable-region-focusable violation on code blocks - #46

Merged
jreades merged 1 commit into
26-27-devfrom
fix/axe-scrollable-code-blocks
Sep 17, 2026
Merged

jreades merged 1 commit into
26-27-devfrom
fix/axe-scrollable-code-blocks

Conversation

@jreades

@jreades jreades commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Quarto's theme CSS sets div.sourceCode { overflow: auto; }, so any code block wider than its container becomes horizontally scrollable, but the div carries no tabindex — keyboard-only users can't focus it to scroll (WCAG 2.1.1, axe rule scrollable-region-focusable).
  • scripts/post.py now adds tabindex="0" to every div.sourceCode block post-render.
  • Ports the same fix already applied to the sibling sds repo's tools/axe_nav_fixes.py, keeping the two toolsets in sync.

Test plan

  • Rendered a revealjs lecture (lectures/3.1-Dictionaries.qmd) and confirmed <div class="sourceCode" tabindex="0" ...> in the output.
  • Confirmed idempotency guard ((?!\s+tabindex)) prevents double-injection on re-render.

🤖 Generated with Claude Code

Quarto's theme CSS sets div.sourceCode { overflow: auto; }, making any
code block wider than its container horizontally scrollable, but that
div has no tabindex — a keyboard-only user can't focus it to scroll
(WCAG 2.1.1, axe rule scrollable-region-focusable). Post-render script
now adds tabindex="0" to every sourceCode block.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 17, 2026 19:51
@jreades
jreades merged commit 1c3b436 into 26-27-dev Sep 17, 2026
@jreades
jreades deleted the fix/axe-scrollable-code-blocks branch September 17, 2026 19:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The matcher must support sourceCode elements with additional classes.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR adds keyboard focusability to horizontally scrollable Quarto code blocks.

Changes:

  • Injects tabindex="0" into rendered div.sourceCode elements.
  • Preserves idempotent post-render processing.
  • Updates the post-render status message.
File summaries
File Summary
scripts/post.py Adds focusability handling for rendered code blocks; the matcher misses blocks with additional classes.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/post.py
# remediation pattern for CSS-scrollable containers and is harmless on
# blocks that never overflow (just one extra, no-op tab stop).
TABINDEX_PATTERNS = [
re.compile(r'<div class="sourceCode"(?!\s+tabindex)'),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants