[fc] Speculative fix for OTPElementUI stack overflow#13333
Open
mindy-stripe wants to merge 3 commits into
Open
[fc] Speculative fix for OTPElementUI stack overflow#13333mindy-stripe wants to merge 3 commits into
mindy-stripe wants to merge 3 commits into
Conversation
tillh-stripe
approved these changes
Jul 8, 2026
| ), | ||
| keyboardActions = KeyboardActions( | ||
| onNext = { focusManager.moveFocusSafely(FocusDirection.Next) }, | ||
| onDone = { focusManager.clearFocus(true) } |
Collaborator
There was a problem hiding this comment.
No more focus clearing when done?
Collaborator
There was a problem hiding this comment.
Hmm, it still does dismiss the keyboard in the FC flow. Also works in the other places where it's used.
Contributor
Author
There was a problem hiding this comment.
my main concern with this approach is with RTL languages, does using index + 1 / index - 1 cause problems there?
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.
Fix OTPElementUI stack overflow and first-digit paste display bug.
Previously,
OTPElementUIadvanced focus by callingFocusManager.moveFocus(FocusDirection.Next)in a loop after each character was entered. This triggered Compose's recursive focus traversal search, which combined with the Android autofill stack depth can cause aStackOverflowErroron some devices. This is a speculative fix that should resolve the recursion when moving focus in theOTPElementUI.https://jira.corp.stripe.com/browse/RUN_LINK_MOBILE-201
How has this been tested?
Reproducible test instructions
(note: couldn't repo the stack overflow myself, so the below is 🤖 speculation)
StackOverflowErrorfrom the original report no longer occurs on a device with autofill enabled