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.

Disable Chrome autofill allowing autoComplete="new-password" to be passed into the Input component properties

See original GitHub issue

Currently, the default Input component is forcefully setting autoComplete="off" which doesn’t disable Chrome’s autofill functionality on latest browser versions. For achieving that, we need to pass autoComplete="new-password".

The problem is that the value is hardcoded and can’t be configured unless we implement our own Input component and configure this property properly there.

It’s hardcoded here: https://github.com/JedWatson/react-select/blob/ba76246a92fe9371b5d4f8795d30119b045dcaba/src/Select.js#L1401

And it gets passed to the default Input component here: https://github.com/JedWatson/react-select/blob/ba76246a92fe9371b5d4f8795d30119b045dcaba/src/components/Input.js#L53

As you can see, there’s no way of configuring that property manually.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:11
  • Comments:16

github_iconTop GitHub Comments

16reactions
Rall3ncommented, Apr 5, 2019

As you can see, there’s no way of configuring that property manually.

@rdsedmundo Yes, there is a possibility to configure it. It is hard coded as a prop to the Input component, that is true. But this library offers in its current version the possibility to overwrite its internal components using its components framework.

You just have to overwrite the Input component and overwrite the prop being passed to the component.

import Select, { components } from 'react-select';

const Input = ({ autoComplete, ...props }) => <components.Input {...props} autoComplete="new-password" />;

<Select
    { ... }
    components={{
        Input
    }}
/>

We have resorted to forking the project, but it would be nice if this were supported natively.

@kylehurt-rkv Here is your native support, without forking the repository.

6reactions
lvl99commented, Jul 4, 2019

Seems like there’s a good reason to have this autoComplete configurable, as based on the age and responses of https://github.com/JedWatson/react-select/pull/2395

Read more comments on GitHub >

github_iconTop Results From Across the Web

html - Disabling Chrome Autofill - Stack Overflow
Just use <form autocomplete="off"> and it prevents the password prefilling as well as any kind of heuristic filling of fields based on assumptions...
Read more >
How to turn off form autocompletion - Web security | MDN
This article explains how a website can disable autocomplete for form fields.
Read more >
How to Disable the Browser Autocomplete and Autofill on ...
Learn how to prevent browsers auto filling the input fields of HTML forms. Use autocomplete="off" to specify that autocomplete is disabled. See examples....
Read more >
React Autocomplete component - Material UI - MUI
The autocomplete is a normal text input enhanced by a panel of suggested options. The widget is useful for setting the value of...
Read more >
914451 - Autofill does not respect autocomplete="off" - Monorail
Chrome will respect autocomplete="no" ...but not "off" ..however, you are unable to set it to "no" except in the developer console, because the...
Read more >

github_iconTop Related Medium Post

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