fix(UI): Add short delay before auto focus on email first#20779
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses an intermittent UI issue on the email-first Settings index page where the browser’s email autocomplete dropdown can appear “orphaned” on the subsequent page if a redirect/unmount happens mid-render, by deferring the email input autofocus slightly.
Changes:
- Replaces synchronous
autoFocuswith a DOM ref + deferred focus viasetTimeout. - Adds a dedicated
emailInputRefpassed down toInputTextviainputRefDOM.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+91
to
+94
| useEffect(() => { | ||
| const timer = setTimeout(() => { | ||
| emailInputRef.current?.focus(); | ||
| }, 10); |
Because: * Users are sometimes seeing what seems to be an orphaned dropdown email list This commit: * Adds a very short settimeout on autofocus of that input, to prevent the dropdown being orphaned if the input unmounts mid-render closes FXA-14009
16596d5 to
c4bfd4b
Compare
vbudhram
approved these changes
Jun 23, 2026
Contributor
Author
|
The functional test failures are known and unrelated. |
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.
Because:
This commit:
closes FXA-14009
I tested this locally and it still autofocuses as expected, and notice no perceptible delay.
0ms might work here just to move off the syncronous
autoFocus, but10msfelt fine just to get past the render.50msor100mswould probably be fine as well but100msespecially seems like it could be at least slightly perceptible but if you have an opinion on a different value I'm all ears, 10ms seems fine to me.