Fix iOS autofill of the sign-in code - #823
Merged
Merged
Conversation
iOS Security-Code AutoFill drops the whole 6-digit code into the first input in one event. maxLength=1 truncated it to a single digit and only the first box was marked one-time-code, so autofill filled just one box. Remove the per-box maxLength, mark every box one-time-code, and spread a multi-character value across the boxes (shared with the paste handler), so a tapped autofill suggestion fills the whole code and submits.
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.
Problem
On iOS, when the 6-digit email sign-in code is offered above the keyboard
("From email: 123456"), tapping it filled only the first digit.
Reported by an LSZO customer; reproduced on
lszo-test.web.appwithBrave + Apple Mail.
Cause
The code field is six separate
<input maxLength={1}>boxes, and onlythe first was marked
autoComplete="one-time-code"(the rest wereoff). iOS Security-Code AutoFill inserts the whole code into onefield;
maxLength={1}truncated it to one digit andhandleChangekept only the last character, discarding the other five.
Fix (
src/components/LoginPage/OtpCodeForm.tsx)maxLength={1}(single-char display is alreadyenforced by the controlled
value), so the full autofilled codereaches
onChange.autoComplete="one-time-code".distribution logic the paste handler used, factored into a shared
fillFrom(startIndex, digits)helper — and auto-submit when complete.Keeps the segmented UI, the
data-cyhandles, and all existing keyboard/ paste behaviour unchanged.
Notes / scope
change — iOS only auto-suggests codes from the Apple Mail app.
Those users continue to copy-paste, which already works.
Verification
npm run typecheckclean; full Jest suite green (2284 tests).OtpCodeForm.spec.tsxextended with an autofill group: a singlechange carrying the whole code into the first field fills all six boxes
and auto-submits.
npm run build --project=lszmcompiles.lszo-test(cannot betested in-repo; the jest autofill test is the local proxy).