question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to disable the browser auto complete feature for the Autocomplete component

See original GitHub issue

In continuation of below closed thread, I’m still unable to disable browser auto complete feature. https://github.com/mui-org/material-ui/issues/18686

  1. The only way I could get autoComplete disabled in Chrome(84.0)/ mac is by having Label value of Autocomplete component to some unrelated text Eg random-text. If i have some appropriate values for label such as Country, or City, then the browser’s auto complete is enabled. But need to have an appropriate label for the field in UI.

  2. Also, I tried passing the inputProps like this <Autocomplete renderInput={ (params) => (<TextField label="Country" inputProps={{ autoComplete: 'new-password' }} /> )} />

This time I do see that autoComplete attribute’s value is passed to the page but when i click on that field in UI, I get the below error. useAutocomplete.js:919 Uncaught TypeError: Cannot read property 'focus' of null at handleClick (useAutocomplete.js:919) at HTMLUnknownElement.callCallback (react-dom.development.js:336) which leads to this line in autoComplete.js var handleClick = function handleClick() { **inputRef.current.focus();**

  1. I noticed that I could disable browser autofill manually, by going Chrome-Dev Tools > Inspect Autocomplete component, then: either a) remove id attribute(thats auto generated) or b)update autoComplete attribute to a randomText. But couldn’t figure out how to get this working in code.

Environment: React: 16.12.x; Material-ui/lab: 4.0.0-alpha.49;

thanks for your help!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dan-mbacommented, Oct 17, 2020

Google Chrome does not currently support autocomplete=off. Issue 587466

I am willing to update the doc to mention this limitation. The doc also might want to mention that using autocomplete=new-password will cause some browsers to recommend a new strong password which might create confusion for non-password fields.

1reaction
LethalPantscommented, Sep 28, 2020

Can I work on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to disable the browser auto complete feature ... - GitHub
I noticed that I could disable browser autofill manually, by going Chrome-Dev Tools > Inspect Autocomplete component, then: either a) remove id ...
Read more >
How to Disable the Browser Autocomplete and Autofill on ...
To disable the autocomplete of text in forms, use the autocomplete attribute of <input> and <form> elements. You'll need the "off" value of...
Read more >
How to turn off form autocompletion - Web security | MDN
This article explains how a website can disable autocomplete for form fields. ... even if the browser's autocomplete feature is enabled.
Read more >
How do you disable browser autocomplete on web form field ...
The first thing to bring up is that auto-complete not being explicitly disabled on login form fields is a PCI-DSS fail. In addition,...
Read more >
How to Enable or Disable Autocomplete in a Web Browser
Open a Chrome browser window. (three vertical dots) in the upper-right corner of the browser window.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found