Skip to content

fix: confine code block horizontal scrolling to the code - #1086

Open
OmerDavidson wants to merge 1 commit into
nodejs:mainfrom
OmerDavidson:fix-code-block-scroll
Open

fix: confine code block horizontal scrolling to the code#1086
OmerDavidson wants to merge 1 commit into
nodejs:mainfrom
OmerDavidson:fix-code-block-scroll

Conversation

@OmerDavidson

@OmerDavidson OmerDavidson commented Sep 5, 2026

Copy link
Copy Markdown

When scrolling horizontally, the footer scrolls too.
image

This PR fixes that

pre was the scroll container for code blocks, so a single long line scrolled the whole block — taking the toolbar (language label and copy button) out of view with it. This moves overflow-x: auto down to the code element so only the code scrolls.

Shiki puts tabindex="0" on the <pre> so the scrollable region is keyboard-reachable; that moves to the <code> element along with the scrolling, otherwise it is left on an element that no longer scrolls.

`pre` was the scroll container, so a long line scrolled the whole code
block, taking the toolbar (language label and copy button) out of view
with it. Move `overflow-x: auto` down to the `code` element so only the
code scrolls.

Shiki's `tabindex="0"` moves along with it, otherwise the scrollable
region stops being reachable by keyboard.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018dS1J3EZzqhxBCc6wmh8Vj
@OmerDavidson
OmerDavidson requested a review from a team as a code owner September 5, 2026 16:26
@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api-docs-tooling Ready Ready Preview Sep 5, 2026 4:29pm UTC

Request Review

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.

1 participant