The browser still autofills a React input marked autoComplete off
<input autoComplete="off" /> still shows saved suggestions or a filled passwordShort answer
React does pass autoComplete to the DOM as the autocomplete attribute. The browser, not React, decides whether to obey it, and it may ignore off on login fields so password managers keep working. Use the value that describes the field, such as new-password or one-time-code.
Fix it fast
1Find out which cause you have
Inspect the input in the browser developer tools and check which autocomplete attribute is on the real element.
document.querySelector('input').getAttribute('autocomplete')2Match what you see, then jump to its fix
- 1
Only username or password inputs are filledThe browser ignores off on login and password fieldsFix - 2
The attribute holds a random string meant to fool autofillA made-up value is used instead of a defined oneFix - 3
One input fills while its neighbours do notoff is set on the field but the form says otherwiseFix
- 1
What does the error look like?
<input autoComplete="off" /> still shows saved suggestions or a filled passwordBrowser asks to save the password for a form that sets autocomplete off
Cause 1 of 3
The browser ignores off on login and password fields
1Check
MDN says browsers may ignore off on login fields to support password managers, and most modern browsers still offer to save and fill credentials.
document.querySelector('input[type=password]').autocomplete2Fix
Use the token that matches the purpose: new-password for a registration or reset field, current-password for sign-in.
<input type="password" name="password" autoComplete="new-password" />3Verify
Reload and open the field; the browser treats it as a new password.
npm run devConfirmed by developer.mozilla.org
Cause 2 of 3
A made-up value is used instead of a defined one
1Check
MDN says invalid or non-standard values mean the browser cannot match the field to any purpose.
grep -rn "autoComplete=" src | grep -v "off\|new-password\|current-password\|one-time-code"2Fix
Use a standard token. For an SMS or email code, one-time-code describes it.
<input name="otp" inputMode="numeric" autoComplete="one-time-code" />3Verify
Check the rendered attribute in the inspector.
document.querySelector('[name=otp]').getAttribute('autocomplete')Confirmed by developer.mozilla.org
Cause 3 of 3
off is set on the field but the form says otherwise
1Check
An input with no autocomplete attribute takes the value of its owning form, so a form-level setting applies to every field that has none of its own.
document.querySelectorAll('form, input').forEach(e => console.log(e.tagName, e.name, e.getAttribute('autocomplete')))2Fix
Set the attribute on the form, or on every input that needs it, and keep a name or id on each input.
<form autoComplete="off">
<input name="coupon" />
</form>3Verify
Reload and focus the field.
npm run devConfirmed by developer.mozilla.org
How do I stop it coming back?
- Reserve off for fields where stored values are wrong, such as one-time tokens.
- Describe each field with the proper autocomplete token instead of fighting the browser.
- Check the attribute on the live DOM when behaviour differs from your JSX.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
Module not found for antd/dist/antd.less after upgrading to Ant Design 5
Module not found: Error: Can't resolve 'antd/dist/antd.less'
Ant Design 5 dropped Less and the bundled CSS file for CSS-in-JS, so antd/dist/antd.less no longer exists.
3 causes, each with a fixWeb apps
Astro Code component fails inside a React component
Astro components cannot be rendered directly via function call
Astro components such as Code only exist on the server and render static HTML.
2 causes, each with a fixWeb apps
React shows Attempted import error when importing a component or function
Attempted import error:
The build found the file but not the name you asked for.
2 causes, each with a fixWeb apps
How to catch and handle a 422 from Axios in a Redux thunk
action.error.message is 'Rejected' and action.payload is undefined
A 422 means the server read the request but cannot process its content, so repeating it unchanged fails again.
4 causes, each with a fixWeb apps
axios gets 429 Too Many Requests from a React app
429 (Too Many Requests)
A 429 comes from the server or an API gateway, not from axios: your client sent too many requests in a window.
4 causes, each with a fixWeb apps
Axios request is not cancelled when a React component unmounts
A cancelled request is logged as an error in the catch block
Axios cancels a request when you pass it an AbortSignal and later call abort() on its controller.
4 causes, each with a fix