Skip to content

fix: allow focusing code block contents - #5575

Merged
Eugene (OEvgeny) merged 7 commits into
mainfrom
fix/focusa-trap-escape
Sep 12, 2025
Merged

fix: allow focusing code block contents#5575
Eugene (OEvgeny) merged 7 commits into
mainfrom
fix/focusa-trap-escape

Conversation

@OEvgeny

@OEvgeny Eugene (OEvgeny) commented Sep 11, 2025

Copy link
Copy Markdown
Collaborator

Fixes #

Changelog Entry

  • Fixed placing focus on the code block content, so it is possible to scroll code via keyboard, in PR #5575, by @OEvgeny

Description

This fixes the scroll behavior of code blocks as well as detection of non-focusable elements, so it's harder to escape from our FocusTrap component.

This also migrates related code block styles to CSSModules.

Specific Changes

  • *.module.css, *.tsx - migrated styles to CSSModules
  • tabbableElements.ts - updated implementation to include detect non focusable element via styles
  • viewCodeButton.scroll.html - test to verify scrolling code block works

-

  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Comment thread __tests__/html2/activity/collapsible.copilot.dark.html.snap-4.png
Comment thread __tests__/html2/part-grouping/copilot.dark.html.snap-10.png

@compulim William Wong (compulim) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's do it!

@OEvgeny
Eugene (OEvgeny) merged commit 1b23c01 into main Sep 12, 2025
51 of 52 checks passed
@OEvgeny
Eugene (OEvgeny) deleted the fix/focusa-trap-escape branch September 12, 2025 04:51
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