Skip to content

auth: keep OTP code readable with larger text scales#9405

Open
lnilluv wants to merge 1 commit intoente-io:mainfrom
lnilluv:auth-2005-font-size-clipping
Open

auth: keep OTP code readable with larger text scales#9405
lnilluv wants to merge 1 commit intoente-io:mainfrom
lnilluv:auth-2005-font-size-clipping

Conversation

@lnilluv
Copy link
Copy Markdown

@lnilluv lnilluv commented Feb 27, 2026

Updated PR desc

Summary

On iOS, accessibility text scaling can go up to ~3.1x, which makes the OTP card title enormous, truncates the account name, and leaves only one card visible on screen.
This fix wraps the card in a MediaQuery override (iOS only) that clamps the text scaler to 2.0x — the same ceiling Android enforces. All text in the card scales proportionally up to that cap. Android is unaffected.

  • code_widget.dart: clamp text scale to 2.0x on iOS; simplify _getBottomRow to a single layout path
  • code_widget_layout_utils.dart: always show next TOTP on iOS regardless of scale
  • test/ui/code_widget_layout_test.dart: unit tests for the layout util

Test plan

  • flutter analyze lib/ui/code_widget.dart lib/ui/code_widget_layout_utils.dart
  • flutter test test/ui/code_widget_layout_test.dart
Screenshots
Android accessibility Android - Max Accessibility
iOS clipping issue max accessibility settings Simulator Screenshot - iPhone 17 Pro - 2026-03-10 at 07 43 44
iOS PR fix max accessibility settings latest-fix-max-accessibility

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 27, 2026

CLA assistant check
All committers have signed the CLA.

@ua741
Copy link
Copy Markdown
Member

ua741 commented Mar 2, 2026

@lnilluv Thank you for the change. Can you please add before and after screenshots, that would help us understand this PR better.

@prateekmedia
Copy link
Copy Markdown
Contributor

Not sure if we should just hide the next code in that scenario

@lnilluv
Copy link
Copy Markdown
Author

lnilluv commented Mar 2, 2026

Not sure if we should just hide the next code in that scenario

I agree I shouldn’t hide the next code if we can avoid it.
I’m seeing a potential Android regression with my current approach, so I’d like to scope this fix to iOS only (issue 2005 is iOS-specific) and keep Android behavior unchanged, I belive it fits better since iOS & Android apps are quite different.
I’ll share before/after iOS screenshots first. If the UI looks OK on your side, I’ll finalize and push the commit.

@lnilluv lnilluv force-pushed the auth-2005-font-size-clipping branch 2 times, most recently from 929b87b to acec917 Compare March 10, 2026 22:17
@lnilluv lnilluv force-pushed the auth-2005-font-size-clipping branch from acec917 to fbeb610 Compare March 10, 2026 23:20
@lnilluv
Copy link
Copy Markdown
Author

lnilluv commented Mar 10, 2026

Updated the PR with screenshots.

I forced push to keep the history clean. The fix now properly targets only iOS.
Only the OTP text had a cap and the card title was still rendering at 3x. The cap is now at the card level to scale everything together and both totp should be visible.

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.

4 participants