Why This Matters
Broken <form> markup breaks password managers (1Password, Bitwarden, iCloud Keychain) and prevents Passkeys Conditional UI from appearing in the browser autofill sheet — causing higher bounce rates and credential-stuffing exposure.
Hardening Checklist for AI Agents
- Use real
<form>with<input type="email">and<input type="password">— avoid<div>-only forms ortype="text"password fields. - Add
autocomplete="username webauthn"on the primary email/username input so browsers trigger Passkey Conditional UI immediately on focus. - Add
autocomplete="current-password"on login password inputs andautocomplete="new-password"on signup/reset forms. - Always pair inputs with explicit
<label for="...">(never rely onplaceholderalone). - Prevent mobile iOS zoom traps: set input font size
>= 16pxand never useuser-scalable=noormaximum-scale=1in<meta name="viewport">. - Check
PublicKeyCredential.isConditionalMediationAvailable()before starting a backgroundnavigator.credentials.get({ mediation: "conditional", ... })call with anAbortController.
Reference Login Markup & Conditional UI Script
<meta name="viewport" content="width=device-width, initial-scale=1">
<form action="/login" method="post">
<label for="email">Work email</label>
<input
id="email"
name="email"
type="email"
autocomplete="username webauthn"
required
style="font-size: 1rem;"
>
<label for="password">Password</label>
<input
id="password"
name="password"
type="password"
autocomplete="current-password"
required
style="font-size: 1rem;"
>
<button type="submit">Sign in</button>
</form>
<script>
async function initConditionalPasskey(publicKeyOptions) {
if (
window.PublicKeyCredential &&
typeof PublicKeyCredential.isConditionalMediationAvailable === "function" &&
(await PublicKeyCredential.isConditionalMediationAvailable())
) {
const controller = new AbortController();
const credential = await navigator.credentials.get({
mediation: "conditional",
signal: controller.signal,
publicKey: publicKeyOptions,
});
// Submit assertion to /api/auth/passkey/verify
return credential;
}
}
</script>
Verification Steps
- Focus the email field in Chrome/Safari with a saved passkey and confirm the passkey prompt appears inside the autofill dropdown.
- Verify Lighthouse / LoginPage.org Stage 1 scan gives full Passkeys (
7/7), Password Manager (7/7), and Mobile UX (6/6) scores.