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.

Expose input autocomplete attribute in Combobox and Input

See original GitHub issue

Newer versions of Chrome completely ignore autocomplete="off". So if you have something like a ComboBox of States and you want to allow a user to filter the options via input, Chrome might recognize the input as part of an Address and try to autofill the State.

A possible solution is to set autocomplete="some_invalid_value" which causes Chrome to not prompt for an autofill value.

The problem with that is, Firefox will default to using autocomplete="on" on invalid values.

Per https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion:

In some cases, the browser will continue suggesting autocompletion values even if the autocomplete attribute is set to off. This unexpected behavior can be quite puzzling for developers. The trick to really enforcing non-autocompletion is to assign an invalid value to the attribute, for example:

autocomplete="nope"

Since this value is not a valid one for the autocomplete attribute, the browser has no way to match it, and stops trying to autocomplete the field. Please note that this does not work in Firefox; it completely disregards the invalid value and reverts to default autocompletion behavior.

In my mind, the only solution is to do a quick browser check before setting any hard values for autocomplete like https://github.com/salesforce/design-system-react/blob/master/components/combobox/combobox.jsx#L809.

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
interactivellamacommented, Feb 16, 2019

Yes @davidlygagnon that’s great idea! Let’s add autocomplete to Input.

As part of that, can you pull the Input prop out of https://github.com/salesforce/design-system-react/pull/1430 so that <Combobox input={<Input autocomplete="GIBBERISH"} /> can handle this for the Combobox via props spread composition.

The developer’s passed in component controlled by the “grandparent” takes precedence and merges in last.

1reaction
curiosity26commented, Jan 21, 2019

Just commenting to keep this alive. Still an issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

ISSUE-627: Naming confusion between aria-autocomplete ...
Under HTML5, <input> elements have an implied autocomplete attribute [1]. When not specified, FF sets the value of autocomplete to "true", and exposes...
Read more >
Combobox (Autocomplete) - Headless UI
Input will automatically open/close the Combobox. ... Each component exposes information about its current state via render props ... Using data attributes.
Read more >
AutoComplete Class | Wijmo API - GrapeCity
The AutoComplete control is an input control that allows callers to customize the item list as the user types. The control is similar...
Read more >
React Autocomplete component - Material UI - MUI
The autocomplete is a normal text input enhanced by a panel of suggested options. ... e.g., a location field must contain a valid...
Read more >
useComboBox – React Aria
A combo box combines a text input with a listbox, allowing users to filter a list of ... useComboBox handles exposing the correct...
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