Skip to content

fix: move text-size-adjust to stable .code-wrap container#15

Open
Huxpro wants to merge 7 commits intomainfrom
Huxpro/fix-text-size-adj-wrap
Open

fix: move text-size-adjust to stable .code-wrap container#15
Huxpro wants to merge 7 commits intomainfrom
Huxpro/fix-text-size-adj-wrap

Conversation

@Huxpro
Copy link
Copy Markdown
Member

@Huxpro Huxpro commented Mar 17, 2026

Summary

Follow-up to #13. The text-size-adjust: 100% fix was applied on .code in code.module.scss, which re-mounts when switching examples — causing the font size inconsistency to reappear.

This PR moves the property to .code-wrap in index.module.scss, which persists across example switches and keeps iOS Safari's automatic font size adjustment disabled at all times.

Changes

  • Removed -webkit-text-size-adjust / text-size-adjust from .code (code.module.scss)
  • Added them to .code-wrap (index.module.scss)

Move -webkit-text-size-adjust: 100% from .code (which re-mounts on
example switch) to .code-wrap (which persists), so iOS Safari's
automatic font size adjustment stays disabled across example switches.
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 17, 2026

Deploy Preview for lynx-go-web ready!

Name Link
🔨 Latest commit d18ffff
🔍 Latest deploy log https://app.netlify.com/projects/lynx-go-web/deploys/69b9272d11f40e000832e21c
😎 Deploy Preview https://deploy-preview-15--lynx-go-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Huxpro added 6 commits March 16, 2026 20:41
Applying text-size-adjust on the parent .code-wrap didn't work —
something downstream resets it. Target pre.shiki directly via :global
to ensure iOS Safari respects the intended font size in code blocks.
The consuming rspress site's styles may override text-size-adjust via
higher specificity. Apply !important on both .code (direct CodeBlock
wrapper) and pre.shiki (inside .code-wrap) to ensure iOS Safari's
auto font-size inflation is disabled regardless of external styles.
WebKit's text autosizing triggers when a block's layout width exceeds
the visible width. Our pre.shiki with white-space:pre had unconstrained
content width, causing per-cluster font boosting on iOS Safari.

The fix: add overflow-x:auto on pre.shiki so it constrains its layout
width to the container (like rspress's normal code blocks do). This
makes WebKit see width ≤ visibleWidth and skip autosizing entirely.

Also move horizontal scrolling from .code-view-container to pre.shiki
(the standard approach for code blocks), and clean up ineffective
text-size-adjust carpet-bombing.
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