feat: Browser autofill support for login form#521
feat: Browser autofill support for login form#521b0x42 wants to merge 9 commits intositeboon:mainfrom
Conversation
Password managers (1Password, Bitwarden, etc.) rely on the HTML `name` and `autocomplete` attributes to detect and fill credential fields. The login and setup forms were missing both, preventing password managers from offering autofill. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAuthentication form components were updated to improve browser autofill support. AuthInputField now accepts optional Changes
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds JSDoc comments to all exported functions and the internal validateSetupForm helper in the auth form files, bringing docstring coverage above the 80% threshold required by CodeRabbit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@coderabbitai review again |
|
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/components/auth/view/SetupForm.tsx (2)
98-120: Prefer explicitnameprops on the credential inputs.This currently works because
AuthInputFieldfalls back fromnametoid. Making the field names explicit here keeps the password-manager contract local to the form and avoids a silent regression if anidis later renamed.♻️ Suggested change
<AuthInputField id="username" + name="username" label="Username" value={formState.username} onChange={(value) => updateField('username', value)} placeholder="Enter your username" isDisabled={isSubmitting} autoComplete="username" /> @@ <AuthInputField id="password" + name="password" label="Password" value={formState.password} onChange={(value) => updateField('password', value)} placeholder="Enter your password" isDisabled={isSubmitting} type="password" autoComplete="new-password" /> @@ <AuthInputField id="confirmPassword" + name="confirmPassword" label="Confirm Password" value={formState.confirmPassword} onChange={(value) => updateField('confirmPassword', value)} placeholder="Confirm your password" isDisabled={isSubmitting} type="password" autoComplete="new-password" />🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/auth/view/SetupForm.tsx` around lines 98 - 120, The credential inputs rely on AuthInputField falling back from id to name; explicitly add name props to each credential AuthInputField (e.g., the fields with id="password" and id="confirmPassword" and the username field above) to set name="password", name="confirmPassword" (and name="username" for the username input) so the password-manager contract is preserved locally in SetupForm and won't break if ids change.
98-120: Add a render-level regression test for these autofill attributes.This change is mostly prop wiring, so it’s easy to break later in either
SetupFormorAuthInputFieldwithout noticing. A component test asserting the renderedname/autocompletepairs would give this feature CI coverage.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/auth/view/SetupForm.tsx` around lines 98 - 120, Add a render-level regression test that mounts the SetupForm and asserts the rendered input elements from AuthInputField have the expected name and autocomplete attributes (e.g., username -> "username", password -> "new-password", confirmPassword -> "new-password"). Write a test that renders SetupForm (mocking any required props/state), queries the inputs by label or placeholder (e.g., "Username", "Password", "Confirm Password"), and asserts each input.element.name and input.getAttribute('autocomplete') match the values wired in SetupForm; include this test near other auth component tests so future changes to SetupForm or AuthInputField will fail CI if these props stop being passed through.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/components/auth/view/SetupForm.tsx`:
- Around line 98-120: The credential inputs rely on AuthInputField falling back
from id to name; explicitly add name props to each credential AuthInputField
(e.g., the fields with id="password" and id="confirmPassword" and the username
field above) to set name="password", name="confirmPassword" (and name="username"
for the username input) so the password-manager contract is preserved locally in
SetupForm and won't break if ids change.
- Around line 98-120: Add a render-level regression test that mounts the
SetupForm and asserts the rendered input elements from AuthInputField have the
expected name and autocomplete attributes (e.g., username -> "username",
password -> "new-password", confirmPassword -> "new-password"). Write a test
that renders SetupForm (mocking any required props/state), queries the inputs by
label or placeholder (e.g., "Username", "Password", "Confirm Password"), and
asserts each input.element.name and input.getAttribute('autocomplete') match the
values wired in SetupForm; include this test near other auth component tests so
future changes to SetupForm or AuthInputField will fail CI if these props stop
being passed through.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: dbbba3a3-7c4d-442f-a9aa-b5f0038e1cc3
📒 Files selected for processing (3)
src/components/auth/view/AuthInputField.tsxsrc/components/auth/view/LoginForm.tsxsrc/components/auth/view/SetupForm.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- src/components/auth/view/LoginForm.tsx
- src/components/auth/view/AuthInputField.tsx
The three AuthInputField calls in SetupForm were relying on the
id-to-name fallback (name={name ?? id}) inside AuthInputField.
Adding explicit name props makes the password-manager contract
self-contained in SetupForm and resilient to future id changes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@coderabbitai review again. I fixed "Prefer explicit name props on the credential inputs.", but fixing "Add a render-level regression test for these autofill attributes." would require to setup a testing framework. More details:
|
|
Would you like me to open a separate GitHub issue to track adding a test harness (vitest + Triggering a fresh review now. ✅ Actions performedReview triggered.
|
|
Ready for Review cc @viper151 |
Problem
Password managers (1Password, Bitwarden, etc.) were not offering to fill credentials on the login and setup forms. This is because browsers and password manager extensions rely on two standard HTML attributes to detect and autofill credential fields:
name— identifies the field in form submissions and is used by password managers to recognize field typesautocomplete— the WHATWG standard hint that tells the browser/extension what type of data a field expectsThe
AuthInputFieldcomponent was rendering<input>elements with neither attribute, so password managers could not identify the fields and did not offer autofill.Solution
AuthInputField.tsx— added optionalnameandautoCompleteprops;namefalls back to theidvalue if not providedLoginForm.tsx— passesautoComplete="username"andautoComplete="current-password"to the respective fieldsSetupForm.tsx— passes explicitnameprops (name="username",name="password",name="confirmPassword") alongsideautoComplete="username"andautoComplete="new-password"(signals a registration form so password managers offer to save new credentials); explicitnameprops make the password-manager contract self-contained and resilient to futureidchangesDocumentation
Added JSDoc comments to
AuthInputField,LoginForm,SetupForm, and thevalidateSetupFormhelper to meet the project's docstring coverage threshold.Test plan
🤖 Generated with Claude Code