Fix table text not scaling with device font scale on mobile (LEMS-3885)#3771
Open
SonicScrewdriver wants to merge 2 commits into
Open
Fix table text not scaling with device font scale on mobile (LEMS-3885)#3771SonicScrewdriver wants to merge 2 commits into
SonicScrewdriver wants to merge 2 commits into
Conversation
The mobile apps honor the device font scale by applying CSS zoom to the page body. Under zoom z, Zoomable measured its container as z times narrower while the child's intrinsic width was unchanged, so its fit-to-width transform scale shrank by exactly z — the net visual size of fitted tables (and block math) was identical to unzoomed, cancelling the font enlargement entirely. Zoomable now fits content to the zoom-adjusted container width (parentWidth × effective zoom), so the fitted content's visual size grows with the font scale like all other text. Overflow at the enlarged size is handled by the existing tap-to-zoom and overflowX scrolling. The effective zoom is read from currentCSSZoom where available (Chrome/Android WebView 128+, Safari/iOS 18.4+) with a fallback to the computed zoom of document.body for older webviews. When no zoom is applied the behavior is unchanged. https://claude.ai/code/session_013e7u2DvJ4UxdpmYC5qsVHL
Contributor
|
Size Change: +26 B (+0.01%) Total Size: 508 kB 📦 View Changed
ℹ️ View Unchanged
|
Contributor
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (6aa3e38) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3771If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3771If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3771 |
Interactive graphs already solve zoom detection for the mobile font scale with getCSSZoomFactor, which accumulates the computed CSS zoom across all ancestors. Move it from interactive-graphs/utils to a shared util module, use it in Zoomable in place of the newly-added getEffectiveZoom (which depended on currentCSSZoom browser support with a body-only fallback), and give the shared helper its own unit tests. https://claude.ai/code/session_013e7u2DvJ4UxdpmYC5qsVHL
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:
The mobile apps honor the device font scale by applying CSS zoom to the
page body. Under zoom z, Zoomable measured its container as z times
narrower while the child's intrinsic width was unchanged, so its
fit-to-width transform scale shrank by exactly z — the net visual size
of fitted tables (and block math) was identical to unzoomed, cancelling
the font enlargement entirely.
Zoomable now fits content to the zoom-adjusted container width
(parentWidth × effective zoom), so the fitted content's visual size
grows with the font scale like all other text. Overflow at the enlarged
size is handled by the existing tap-to-zoom and overflowX scrolling.
The effective zoom is read from currentCSSZoom where available
(Chrome/Android WebView 128+, Safari/iOS 18.4+) with a fallback to the
computed zoom of document.body for older webviews. When no zoom is
applied the behavior is unchanged.
Issue: LEMS-3885
Test plan: