fix: move text-size-adjust to stable .code-wrap container#15
Open
fix: move text-size-adjust to stable .code-wrap container#15
Conversation
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.
✅ Deploy Preview for lynx-go-web ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #13. The
text-size-adjust: 100%fix was applied on.codeincode.module.scss, which re-mounts when switching examples — causing the font size inconsistency to reappear.This PR moves the property to
.code-wrapinindex.module.scss, which persists across example switches and keeps iOS Safari's automatic font size adjustment disabled at all times.Changes
-webkit-text-size-adjust/text-size-adjustfrom.code(code.module.scss).code-wrap(index.module.scss)