Skip to content

Fix passkey autofocus issue in client helpers#36

Open
tsunoyu wants to merge 1 commit intoGoogleChromeLabs:mainfrom
tsunoyu:fix/passkey-autofocus
Open

Fix passkey autofocus issue in client helpers#36
tsunoyu wants to merge 1 commit intoGoogleChromeLabs:mainfrom
tsunoyu:fix/passkey-autofocus

Conversation

@tsunoyu
Copy link
Copy Markdown

@tsunoyu tsunoyu commented Nov 20, 2025

Description

This PR updates the Loading helper class in src/client/helpers/index.ts to correctly manage standard HTML input elements alongside mdui-text-field web components.

The "Passkey form autofill" flow (passkey-form-autofill.html) relies on the autofocus attribute to automatically trigger the browser's WebAuthn conditional UI (the passkey selection prompt) immediately upon page load.

Previously, the Loading helper used in the client logic only targeted mdui-text-field elements when toggling the disabled state. This resulted in incomplete state management for forms containing standard <input> tags (such as hidden password fields or fallback inputs). This state inconsistency prevented the autofocus behavior from correctly triggering the passkey prompt.

Changes

  • src/client/helpers/index.ts
    • Updated the querySelectorAll selector in both start() and stop() methods to target mdui-text-field, input instead of just mdui-text-field.
    • Added type casting to ensure the disabled property is correctly applied to both element types.

Testing

  1. Navigate to the "Passkey form autofill" page (/passkey-form-autofill).
  2. Ensure you have a passkey saved for this domain.
  3. Refresh the page.
  4. Observe: The browser's passkey autofill prompt should appear automatically over the username field without requiring a user click.

@agektmr agektmr changed the base branch from main to staging December 10, 2025 14:09
@agektmr agektmr self-requested a review December 10, 2025 14:10
@agektmr
Copy link
Copy Markdown
Collaborator

agektmr commented Dec 13, 2025

Did you confirm that this code is excuted when you load /passkey-form-autofill? I can't confirm.

@agektmr agektmr changed the base branch from staging to main February 5, 2026 06:54
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.

2 participants