Repository navigation
fix(composer): avoid double-scaling mention mirror text under Android WebView textZoom - #473
Merged
SiddDevZ merged 1 commit intoDec 3, 2026
Conversation
… WebView textZoom
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.
What and why
On Android WebView,
WebSettings.setTextZoomscalesfont-sizeandline-heighteven whentext-size-adjust: noneand-webkit-text-size-adjust: noneare set on.mention-editor-mirror. BecauseMentionTextareacopiesgetComputedStyle(input)onto the mirror, Android WebView applies the system text scale a second time to the mirror's words, pushing the drawn text off the textarea's caret.font-sizeandline-heightout ofTEXT_LAYOUTintoZOOMED_TEXT_LAYOUTinsrc/components/MentionTextarea.tsxand sync them throughsyncZoomedLength. When the mirror's computed length drifts from the textarea's (outside a0.05pxtolerance), it scales the written inline value down in up to two passes so both elements render at the same computed metrics. Non-numeric values (such asline-height: normal) are copied verbatim, and subsequent syncs return early without rewriting when the computed metrics already match.windowdusk:text-scaleevents inMentionTextareato re-runresize()(recomputing field height and mirror metrics when text scale changes) and remove the listener on unmount.src/components/MentionTextarea.dom.test.tscovering WebView text-zoom compensation and the scroll fast path, non-numericline-heightfallback, anddusk:text-scalere-sync + unmount cleanup.How it was checked
Based on upstream
dev(8f86ab208), head branchfix/android-mention-textarea-text-zoom:node scripts/typecheck.mjs(pnpm typecheck): passed.tsc -p apps/mobile/tsconfig.json --noEmit(mobile typecheck): passed.oxlint --deny-warnings .(pnpm lint): 0 warnings, 0 errors across 8,247 files.node scripts/generate-locale.mjs --check(pnpm i18n:check): passed.vite build: passed.src/components/MentionTextarea.dom.test.tsandsrc/components/MentionTextarea.test.ts: 2 files, 11 passed (including 3 new regression tests).MentionTextarea*,MentionText,MentionColors,text-scale,Composer.phone,Composer.mentions,Composer.slash,Composer.ime,Composer.dictation,scripts/testing/file-size-ratchet.test.ts,src/locales/vocabulary.test.ts): 12 files, 70 passed.The full repository
pnpm testsuite and on-device Android WebView verification were not run locally.pnpm typecheck,pnpm lintandpnpm testpass