Skip to content

fix(phone): ignore iPad Return key in VerificationCodeInputField - #1408

Open
amansingh1207 wants to merge 2 commits into
firebase:mainfrom
amansingh1207:fix/verification-return-ipad
Open

amansingh1207 wants to merge 2 commits into
firebase:mainfrom
amansingh1207:fix/verification-return-ipad

Conversation

@amansingh1207

@amansingh1207 amansingh1207 commented Oct 12, 2026 •

Copy link
Copy Markdown

Fixes #1407. iPad hardware Return now resigns via textFieldShouldReturn without mutating digitFields; returnKeyType .done. No newline guard - digitsOnly filter already blocks lone Return and preserves paste of 123456\n from SMS/email.

@google-cla

google-cla Bot commented Oct 12, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request configures the return key type to .done for the verification code input field and handles the Return key behavior to support iPad hardware keyboards. The review feedback correctly points out that ignoring newlines and carriage returns in shouldChangeCharactersIn will break pasting verification codes that contain trailing newlines (e.g., from SMS or email), and recommends removing this check.

Comment on lines +470 to +473
// Ignore Return/newline (iPad hardware keyboard) — not a digit, not a delete.
if string.contains("\n") || string.contains("\r") {
return false
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Checking string.contains("\n") or string.contains("\r") and returning false will prevent users from pasting verification codes that contain trailing newlines or carriage returns (which is very common when copying from SMS or email). Since the subsequent digitsOnly check already filters out non-digit characters and returns false if no digits are present, this check is redundant for single Return key presses and breaks pasting. Removing this check preserves the paste functionality while textFieldShouldReturn correctly handles the Return key.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — removed newline guard. digitsOnly already blocks lone Return and preserves paste with trailing newline. textFieldShouldReturn handles iPad hardware Return.

Return from iPad hardware keyboard must resign without mutating digitFields. Previously repeated Return could clear/backspace through OTP boxes. Add textFieldShouldReturn -> resign + return false, explicit newline guard in shouldChangeCharactersIn, and returnKeyType .done.
@amansingh1207
amansingh1207 force-pushed the fix/verification-return-ipad branch from faa27cc to 7fa3d44 Compare October 12, 2026 18:50
Paste of '123456\n' from SMS/email must still work - digitsOnly filter already rejects lone Return. textFieldShouldReturn handles iPad hardware Return.
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.

VerificationCodeInputField: iPad Return key clears/hides OTP fields

1 participant