Skip to content

feat: add accessibility hint for code block exit - #3209

Merged
AlexAndBear merged 5 commits into
mainfrom
feat/codeblock-a11y-exit-hint
Aug 24, 2026
Merged

AlexAndBear merged 5 commits into
mainfrom
feat/codeblock-a11y-exit-hint

Conversation

@AlexAndBear

@AlexAndBear AlexAndBear commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

Description

Adds ARIA attributes to the code block component to improve accessibility for keyboard navigation. When tab indentation is enabled in code blocks, users can no longer use the Tab key to exit. This PR adds aria-describedby to inform screen reader users that Shift+Enter is the keyboard shortcut to exit the code block.

The implementation uses:

  • aria-describedby
  • A visually hidden <span> with Tailwind's sr-only class containing the hint text
  • UUID v4 for generating unique IDs to support multiple code blocks on the same page

Related Issue

N/A

How Has This Been Tested

  • Test environment: Local development
  • Test cases:
    • Screen reader announces the code block and the exit hint when focused
    • Shift+Enter successfully exits the code block
    • Tab key continues to indent within the code block
    • Multiple code blocks on the same page have unique ARIA references

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt (code improvements)
  • Tests (added or updated tests)
  • Documentation
  • Maintenance

@AlexAndBear
AlexAndBear force-pushed the feat/codeblock-a11y-exit-hint branch from 8443e6a to 83e49af Compare August 24, 2026 09:56
@AlexAndBear AlexAndBear self-assigned this Aug 24, 2026
@AlexAndBear
AlexAndBear force-pushed the feat/codeblock-a11y-exit-hint branch from 83e49af to fce2b56 Compare August 24, 2026 09:57
Add ARIA attributes to code block component to inform screen reader users about the Shift+Enter keyboard shortcut to exit the code block. This improves accessibility for users who rely on assistive technologies when tab indentation is enabled.
@AlexAndBear
AlexAndBear force-pushed the feat/codeblock-a11y-exit-hint branch from b09e4f9 to aa0ac93 Compare August 24, 2026 10:15
@AlexAndBear
AlexAndBear merged commit 02d0beb into main Aug 24, 2026
31 checks passed
@AlexAndBear
AlexAndBear deleted the feat/codeblock-a11y-exit-hint branch August 24, 2026 13:10
@openclouders openclouders mentioned this pull request Aug 24, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants