Skip to content

Conversation

jineshshah36
Copy link
Contributor

WHY are these changes introduced?

Some browsers (I'm looking at you Chrome) ignore autocomplete="off" because they think they know better. As a result, setting autocomplete="off" does not disable autocomplete. A better way to disable autocomplete is to use any string that does not match a valid autocomplete value such as "nope". See https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#Disabling_autocompletion for more details.

WHAT is this pull request doing?

This will not make any UI changes

Some browsers (I'm looking at you Chrome) ignore autocomplete="off" because they think they know better. As a result, setting autocomplete="off" does not disable autocomplete. A better way to disable autocomplete is to use any string that does not match a valid autocomplete value such as "nope". See https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#Disabling_autocompletion for more details.
@ghost
Copy link

ghost commented Nov 30, 2018

👋 Thanks for opening your first pull request. A contributor should give feedback soon. If you haven’t already, please check out the contributing guidelines. You can also join #polaris on the Shopify Partners Slack.

@ghost ghost added the cla-needed Added by a bot. Contributor needs to sign the CLA Agreement. label Nov 30, 2018
@ghost ghost removed the cla-needed Added by a bot. Contributor needs to sign the CLA Agreement. label Nov 30, 2018
Copy link

@danrosenthal danrosenthal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @jineshshah36! This looks great. Just one change on the UNRELEASED.md and this should be good to go

@danrosenthal
Copy link

danrosenthal commented Dec 3, 2018

🎩 this PR on branch tophat-708 with this playground:

import * as React from 'react';
import {Page, TextField} from '@shopify/polaris';

interface State {
  value: string | undefined;
}

export default class Playground extends React.Component<{}, State> {
  state: State = {
    value: undefined,
  };

  render() {
    return (
      <Page
        title="Playground"
        primaryAction={{content: 'View Examples', url: '/examples'}}
      >
        <TextField
          label="Email"
          value={this.state.value}
          onChange={this.handleChange}
          autoComplete={false}
          type="email"
        />
      </Page>
    );
  }

  handleChange = (value: string) => {
    this.setState({value});
  };
}

@danrosenthal danrosenthal merged commit eb09865 into Shopify:master Dec 3, 2018
@ghost
Copy link

ghost commented Dec 3, 2018

🎉 Thanks for your contribution to Polaris React!

@danrosenthal danrosenthal temporarily deployed to production December 4, 2018 19:16 Inactive
@jineshshah36 jineshshah36 deleted the patch-1 branch December 7, 2018 02:42
@mbaumbach
Copy link
Contributor

@danrosenthal @jineshshah36 I'm actually seeing the reverse situation in Chrome 71. When autocomplete="nope" is used, I'm getting autocomplete results, but when it's set to autocomplete="off" I don't. It looks like Kent C. Dodd and the PayPal team had to pull a 180° on this as well (see: downshift-js/downshift#527 (comment))

I'm specifically testing this with the Autocomplete component and setting the Autocomplete.TextField to have autoComplete={false}.

@jineshshah36
Copy link
Contributor Author

I'm also seeing this now. I'm thinking we should also revert this

@jakec-dev
Copy link

If you change it to autocomplete='__nope' then it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants