Skip to content

fix: prevent text overflow on narrow screens - #2207

Open
luozejian wants to merge 1 commit into
sveltejs:mainfrom
luozejian:fix-530-mobile-overflow
Open

fix: prevent text overflow on narrow screens#2207
luozejian wants to merge 1 commit into
sveltejs:mainfrom
luozejian:fix-530-mobile-overflow

Conversation

@luozejian

@luozejian luozejian commented Aug 29, 2026

Copy link
Copy Markdown

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time.
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.

Fixes #530

Problem

On narrow mobile viewports, consecutive inline code elements separated by punctuation could expand the documentation content beyond the viewport.

On the Svelte 5 migration guide, the clientWidth / clientHeight / offsetWidth / offsetHeight sequence caused horizontal scrolling. As a result, the bottom previous/next navigation appeared to be hidden outside the viewport.

Solution

Allow regular content rendered by the shared Text component to wrap when necessary, while keeping inline code and kbd tokens intact.

This lets the browser wrap consecutive inline code elements at their separators instead of breaking identifiers or expanding the page width.

This PR only changes the shared Text component styling. It does not modify synced documentation content.

Validation

At a 320px viewport:

  • Before: page scrollWidth was 350px
  • After: page scrollWidth is 320px
  • The previous/next controls remain entirely within the viewport
  • Inline code identifiers remain intact

Also verified at a 360px viewport.

The following checks pass:

  • pnpm --filter @sveltejs/site-kit lint
  • pnpm --filter @sveltejs/site-kit check
  • pnpm --filter svelte.dev check
  • pnpm build

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

@luozejian is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
next-svelte-dev Ready Ready Preview Aug 29, 2026 5:43pm
svelte-dev Ready Ready Preview Aug 29, 2026 5:43pm

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.

Bottom nav hidden when text overflows - mobile

1 participant