Skip to content

Fix table text not scaling with device font scale on mobile (LEMS-3885)#3771

Open
SonicScrewdriver wants to merge 2 commits into
mainfrom
turning-the-tables
Open

Fix table text not scaling with device font scale on mobile (LEMS-3885)#3771
SonicScrewdriver wants to merge 2 commits into
mainfrom
turning-the-tables

Conversation

@SonicScrewdriver

@SonicScrewdriver SonicScrewdriver commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

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:

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
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Size Change: +26 B (+0.01%)

Total Size: 508 kB

📦 View Changed
Filename Size Change
packages/perseus/dist/es/index.js 200 kB +26 B (+0.01%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.6 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 6.32 kB
packages/math-input/dist/es/index.js 98.5 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.item-splitting.js 12 kB
packages/perseus-core/dist/es/index.js 26.3 kB
packages/perseus-editor/dist/es/index.js 105 kB
packages/perseus-linter/dist/es/index.js 9.8 kB
packages/perseus-score/dist/es/index.js 10.2 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/strings.js 8.6 kB
packages/pure-markdown/dist/es/index.js 1.39 kB
packages/simple-markdown/dist/es/index.js 6.71 kB

compressed-size-action

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (6aa3e38) and published it to npm. You
can install it using the tag PR3771.

Example:

pnpm add @khanacademy/perseus@PR3771

If you are working in Khan Academy's frontend, you can run the below command.

./dev/tools/bump_perseus_version.ts -t PR3771

If 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants