Skip to content

fix(auth): Wait for document focus before triggering WebAuthn 2FA - #128746

Open
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/webauthn-wait-for-document-focus
Open

sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/webauthn-wait-for-document-focus

Conversation

@sentry

@sentry sentry Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

When navigating through the V2 login flow, WebAuthn 2FA immediately triggers navigator.credentials.get() upon receiving the challenge. In Safari on macOS, calling WebAuthn APIs while the document is unfocused (e.g. if the user briefly switches to a password manager or another window while the challenge loads) throws a NotAllowedError: The document is not focused., which is captured in Sentry and displays an authentication failure to the user.

This aligns WebAuthn2FAMethod with the pattern already used in webAuthnAssert.tsx: check document.hasFocus() first and, if false, wait for a focus event on window before requesting the assertion.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes JAVASCRIPT-3C1E

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry
sentry Bot requested review from a team as code owners October 25, 2026 22:45
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 25, 2026

This branch was successfully deployed

1 active deployment
Preview — a3b04cb2 Deployed Oct 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants