feat(settings): show a loading state and lock other options during passkey sign-in - #20933
Draft
vpomerleau wants to merge 1 commit into
Draft
feat(settings): show a loading state and lock other options during passkey sign-in#20933vpomerleau wants to merge 1 commit into
vpomerleau wants to merge 1 commit into
Conversation
…sskey sign-in Because: - After passkey verification succeeded, the surface stayed rendered with no success indication while navigation was pending; the passkey button reverted to a clickable state, which was confusing and invited unintended retries. - Other sign-in options stayed interactive while a sign-in attempt was in flight, so a competing method could race the one already running. This commit: - Adds an isNavigating state to usePasskeySignIn, raised only on committed success (never on an error), and renders AppLayout's loading spinner on all four passkey sign-in surfaces while navigation or the WebChannel handoff is pending. - Adds a form-lock that disables the other sign-in options on a surface while a submit or passkey ceremony is in flight, via new optional disabled props on ButtonPasskeySignin, ThirdPartyAuth, AlternativeAuthOptions, and FormVerifyCode. Closes #FXA-14267
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a clearer “in progress” UX for passkey sign-in in fxa-settings by introducing a page-level loading state during the post-verification navigation/handoff, and by locking out competing sign-in methods on the same surface while any one attempt is in flight.
Changes:
- Added
isNavigatingtousePasskeySignInand wired it into sign-in surfaces viaAppLayout loading=...so success doesn’t “snap back” to an interactive state while navigation/handoff is pending. - Implemented a bidirectional form-lock by threading new optional
disabledprops through passkey / third-party / OTP verification components and using them from the sign-in pages. - Added/updated unit tests to cover the new hook state and the new lock/disabled behaviors.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/fxa-settings/src/pages/Signin/SigninPasswordlessCode/index.tsx | Mirrors OTP submit state to lock passkey/resend actions during OTP verification; shows page-level loading during passkey navigation. |
| packages/fxa-settings/src/pages/Signin/SigninPasswordlessCode/index.test.tsx | Adds tests ensuring passkey/resend are disabled during OTP verification and re-enabled on failure. |
| packages/fxa-settings/src/pages/Signin/index.tsx | Separates “attempt in flight” from lingering submit-disable state; locks alternative auth options while attempts run; shows page-level loading for passkey navigation. |
| packages/fxa-settings/src/pages/Signin/index.test.tsx | Adds test verifying alternatives remain enabled after a failed password attempt. |
| packages/fxa-settings/src/pages/Signin/components/SigninAlternativeAuthOptions/index.tsx | Locks options while a passkey ceremony is running and enables page-level loading during navigation. |
| packages/fxa-settings/src/pages/Index/index.tsx | Locks email-first submit and alternative options while passkey or email submission is in flight; enables page-level loading during passkey navigation. |
| packages/fxa-settings/src/lib/passkeys/signin-flow.ts | Introduces isNavigating state and sets it only on committed-success navigation/handoff paths. |
| packages/fxa-settings/src/lib/passkeys/signin-flow.test.tsx | Adds coverage for isNavigating behavior across success, navigation error, required-password routing, cancellation, and WebChannel cases. |
| packages/fxa-settings/src/components/ThirdPartyAuth/index.tsx | Adds disabled prop to prevent starting provider flows while another method is in flight. |
| packages/fxa-settings/src/components/ThirdPartyAuth/index.test.tsx | Tests that disabled third-party buttons don’t trigger provider flow or navigation. |
| packages/fxa-settings/src/components/ThirdPartyAuth/snapshots/index.test.tsx.snap | Updates snapshots for new disabled styling classes on icon buttons. |
| packages/fxa-settings/src/components/FormVerifyCode/mocks.tsx | Extends mock Subject to accept and pass through isThrottled and disabled. |
| packages/fxa-settings/src/components/FormVerifyCode/index.tsx | Adds external disabled prop and guards submit entry points (button + paste auto-submit) against external locks. |
| packages/fxa-settings/src/components/FormVerifyCode/index.test.tsx | Adds test ensuring disabled keeps submit disabled even with a valid code. |
| packages/fxa-settings/src/components/ButtonPasskeySignin/index.tsx | Adds disabled prop to lock the passkey button without showing the loading spinner. |
| packages/fxa-settings/src/components/ButtonPasskeySignin/index.test.tsx | Adds tests for disabled-without-spinner behavior and click suppression when disabled. |
| packages/fxa-settings/src/components/AlternativeAuthOptions/index.tsx | Adds disabled prop and wires it into passkey + third-party subcomponents for surface-level locking. |
| packages/fxa-settings/src/components/AlternativeAuthOptions/index.test.tsx | Adds tests verifying disabled locks passkey and third-party options, and leaves them enabled otherwise. |
Comment on lines
161
to
163
| setSigninLoading(true); | ||
| setSigninAttemptInFlight(true); | ||
| const { data, error } = await beginSigninHandler(email, password); |
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 pull request
isNavigatingstate tousePasskeySignIninpackages/fxa-settings/src/lib/passkeys/signin-flow.ts, raised only on committed-success paths (never on an error), and passesloading={passkey.isNavigating}toAppLayouton all four passkey sign-in surfaces (Index,Signin,SigninAlternativeAuthOptions,SigninPasswordlessCode) so the page shows a spinner through navigation / the WebChannel handoff instead of a reverted button.disabledprops onButtonPasskeySignin,ThirdPartyAuth,AlternativeAuthOptions, andFormVerifyCode.Signinpage, tracks the password attempt separately (signinAttemptInFlight) so a failed password releases the passkey/third-party lock immediately, while the submit button keeps its existing disabled-until-edited behaviour.disabledprops on the shared components, and the Signin/OTP form-lock behaviour.Issue that this pull request solves
Closes: FXA-14267
Checklist
Put an
xin the boxes that applyHow to review (Optional)
packages/fxa-settings/src/lib/passkeys/signin-flow.ts— theisNavigatingstate machine and its error-path resets.signin-flow.ts) → shared components (ButtonPasskeySignin,ThirdPartyAuth,AlternativeAuthOptions,FormVerifyCode) → surfaces (Index,Signin,SigninPasswordlessCode,SigninAlternativeAuthOptions).isNavigatingis set only after navigation is committed, and every cancel/error path routes throughfinish()to reset the loading/disabled state.Screenshots (Optional)
Please attach the screenshots of the changes made in case of change in user interface.
Other information (Optional)
Any other information that is important to this pull request.