Skip to content

Conversation

@andrewmcgov
Copy link
Contributor

@andrewmcgov andrewmcgov commented Jun 17, 2021

WHY are these changes introduced?

Fixes https://github.com/Shopify/core-issues/issues/26319

Makes autoComplete a required prop on the TextField component as part of the autocomplete project.

WHAT is this pull request doing?

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import React from 'react';

import {Page, TextField} from '../src';

export function Playground() {
  const [email, setEmail] = React.useState('');
  return (
    <Page title="Playground">
      <TextField
        label="Email"
        type="email"
        value={email}
        onChange={setEmail}
        autoComplete="email"
      />
    </Page>
  );
}

🎩 checklist

  • Tested on mobile
  • Tested on multiple browsers
  • Tested for accessibility
  • Updated the component's README.md with documentation changes
  • Tophatted documentation changes in the style guide
  • For visual design changes, pinged one of @ HYPD, @ mirualves, @ sarahill, or @ ry5n to update the Polaris UI kit

step?: number;
/** Enable automatic completion by the browser */
autoComplete?: boolean | string;
/** Enable automatic completion by the browser. Set to "off" when you do not want the browser to fill in info */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will update wording when we have alignment on off / nope

@alex-page alex-page changed the base branch from main to v7.0.0-release June 17, 2021 14:56
@alex-page
Copy link
Member

alex-page commented Jun 17, 2021

This will require a changelog entry to unreleased.md with some instructions on how to update with the breaking change.

@andrewmcgov andrewmcgov force-pushed the TextField_require_autoComplete branch 3 times, most recently from c08d790 to d2e9084 Compare June 25, 2021 15:09
@github-actions
Copy link
Contributor

github-actions bot commented Jun 25, 2021

size-limit report

Path Size
cjs 142.05 KB (-0.01% 🔽)
esm 95.65 KB (-0.03% 🔽)
esnext 138.95 KB (-0.01% 🔽)
css 33.82 KB (0%)

@andrewmcgov andrewmcgov force-pushed the TextField_require_autoComplete branch from d2e9084 to d6c81a4 Compare June 25, 2021 15:15
@andrewmcgov andrewmcgov changed the title [WIP][TextField] Make autoComplete prop a required string [TextField] Make autoComplete prop a required string Jun 25, 2021
@andrewmcgov andrewmcgov force-pushed the TextField_require_autoComplete branch 2 times, most recently from b6cbd09 to 6e89000 Compare June 28, 2021 21:28
Comment on lines 245 to 250
it('changes autoComplete value to "nope" when there is no name', () => {
const textField = mountWithAppProvider(
<TextField label="TextField" autoComplete onChange={noop} />,
<TextField label="TextField" onChange={noop} autoComplete="off" />,
);
expect(textField.find('input').prop('autoComplete')).toBe('on');
});

it('sets autoComplete to string value when string is given', () => {
const textField = mountWithAppProvider(
<TextField
label="TextField"
autoComplete="firstName"
onChange={noop}
/>,
);
expect(textField.find('input').prop('autoComplete')).toBe('firstName');
expect(textField.find('input').prop('autoComplete')).toBe('nope');
Copy link
Member

Choose a reason for hiding this comment

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

Awesome 💯

} else if (autoComplete === false) {
return 'off';
function normalizeAutoComplete(autoComplete: string, name?: string) {
if (autoComplete === 'off' && !name) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the logic is if === off && there is a name --> Change to nope.
If no name and off, leave it alone.

@andrewmcgov andrewmcgov force-pushed the TextField_require_autoComplete branch from 6e89000 to b604ebf Compare June 29, 2021 18:31
@andrewmcgov andrewmcgov merged commit e956a40 into v7.0.0-release Jun 30, 2021
@andrewmcgov andrewmcgov deleted the TextField_require_autoComplete branch June 30, 2021 14:27
voiid added a commit that referenced this pull request Jul 15, 2021
* Upgrade to node v12 (#4191)

* Move to node v12

* Bump merge-deep from 3.0.2 to 3.0.3 (#4254)

Bumps [merge-deep](https://github.com/jonschlinkert/merge-deep) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/jonschlinkert/merge-deep/releases)
- [Commits](jonschlinkert/merge-deep@3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: merge-deep
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws in /examples/create-react-app-ts-react-testing (#4242)

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws from 6.2.1 to 6.2.2 in /examples/create-react-app (#4241)

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws from 6.2.1 to 6.2.2 in /examples/webpack (#4240)

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update UNRELEASED.md

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump react and react-dom to v16.14.0 (#4279)

Co-authored-by: Ben Scott <227292+BPScott@users.noreply.github.com>

* [TextField] Make autoComplete prop a required string (#4267)

* Require autoComplete prop on TextField

* switch to autoComplete="off" as default

* Adding off recommendation.

* Fix link formatting issue in TextField/README.md

Co-authored-by: Genevieve Bulger <genevieve.bulger@shopify.com>

* Update browserslist to match shopify/browserslist-config v3.0.0 (#4304)

- Desktop Safari version is "last 3 safari versions" - mapping to
  Safari 13.1
- ios Safari version is "ios >= 13.4" - mapping to ios_saf 13.4-13.7

* [AutoComplete] Rebuild autocomplete internals to use new accessible components (#3910)

* Rebuild AutoComplete internals to fix accessibility issues

 - Replace internals with new combobox and list box
 - Add support for legacy combobox
 - Allow TextField and Checkbox to leverage new combobox
 - Include additional test coverage for autocomplete and new components

Co-authored-by: Andrew Musgrave <andrew.musgrave@shopify.com>
Co-authored-by: Daniel Leroux <daniel.leroux@shopify.com>

* Fix some accessibility warnings on listbox stories

* Remove listbox section example

Co-authored-by: Andrew Musgrave <andrew.musgrave@shopify.com>
Co-authored-by: Daniel Leroux <daniel.leroux@shopify.com>

Co-authored-by: Alex Page <alex@alexpage.com.au>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ben Scott <227292+BPScott@users.noreply.github.com>
Co-authored-by: Andrew McGoveran <andrew.mcgoveran@shopify.com>
Co-authored-by: Genevieve Bulger <genevieve.bulger@shopify.com>
Co-authored-by: Andrew Musgrave <andrew.musgrave@shopify.com>
Co-authored-by: Daniel Leroux <daniel.leroux@shopify.com>
luanpy pushed a commit that referenced this pull request Jul 17, 2021
* Require autoComplete prop on TextField

* switch to autoComplete="off" as default

* Adding off recommendation.

* Fix link formatting issue in TextField/README.md

Co-authored-by: Genevieve Bulger <genevieve.bulger@shopify.com>
voiid added a commit that referenced this pull request Aug 11, 2021
* Upgrade to node v12 (#4191)

* Move to node v12

* Bump merge-deep from 3.0.2 to 3.0.3 (#4254)

Bumps [merge-deep](https://github.com/jonschlinkert/merge-deep) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/jonschlinkert/merge-deep/releases)
- [Commits](jonschlinkert/merge-deep@3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: merge-deep
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws in /examples/create-react-app-ts-react-testing (#4242)

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws from 6.2.1 to 6.2.2 in /examples/create-react-app (#4241)

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws from 6.2.1 to 6.2.2 in /examples/webpack (#4240)

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update UNRELEASED.md

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump react and react-dom to v16.14.0 (#4279)

Co-authored-by: Ben Scott <227292+BPScott@users.noreply.github.com>

* [TextField] Make autoComplete prop a required string (#4267)

* Require autoComplete prop on TextField

* switch to autoComplete="off" as default

* Adding off recommendation.

* Fix link formatting issue in TextField/README.md

Co-authored-by: Genevieve Bulger <genevieve.bulger@shopify.com>

* Update browserslist to match shopify/browserslist-config v3.0.0 (#4304)

- Desktop Safari version is "last 3 safari versions" - mapping to
  Safari 13.1
- ios Safari version is "ios >= 13.4" - mapping to ios_saf 13.4-13.7

* [AutoComplete] Rebuild autocomplete internals to use new accessible components (#3910)

* Rebuild AutoComplete internals to fix accessibility issues

 - Replace internals with new combobox and list box
 - Add support for legacy combobox
 - Allow TextField and Checkbox to leverage new combobox
 - Include additional test coverage for autocomplete and new components

Co-authored-by: Andrew Musgrave <andrew.musgrave@shopify.com>
Co-authored-by: Daniel Leroux <daniel.leroux@shopify.com>

* Fix some accessibility warnings on listbox stories

* Remove listbox section example

Co-authored-by: Andrew Musgrave <andrew.musgrave@shopify.com>
Co-authored-by: Daniel Leroux <daniel.leroux@shopify.com>

* Update to node 12.22.0 and react-testing v3.2.0 (#4349)

* Update node version to 12.22.0

Released on 2021-03-30, this is the first version of node where
esmodules are considered stable. We're not relying on that yet, but this
sets the stage for the future.

* Update @shopify/react-testing to v3.2.0

This adds support for React 17 so future migration will be easier

* Remove deprecated languages (#4351)

* Update translation.yml

* Delete locales/hi.json

* Delete locales/ms.json

* format translation.yml as expected

Co-authored-by: translation-platform[bot] <35075727+translation-platform@users.noreply.github.com>

* Rename ComboBox and ListBox to Combobox and Listbox (#4379)

* Fix autocomlete docs

Co-authored-by: Alex Page <alex@alexpage.com.au>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ben Scott <227292+BPScott@users.noreply.github.com>
Co-authored-by: Andrew McGoveran <andrew.mcgoveran@shopify.com>
Co-authored-by: Genevieve Bulger <genevieve.bulger@shopify.com>
Co-authored-by: Andrew Musgrave <andrew.musgrave@shopify.com>
Co-authored-by: Daniel Leroux <daniel.leroux@shopify.com>
Co-authored-by: Kyle Durand <kyle.durand@shopify.com>
Co-authored-by: Al-Campuzano <32461613+Al-Campuzano@users.noreply.github.com>
Co-authored-by: translation-platform[bot] <35075727+translation-platform@users.noreply.github.com>
alex-page pushed a commit that referenced this pull request Aug 25, 2021
* Require autoComplete prop on TextField

* switch to autoComplete="off" as default

* Adding off recommendation.

* Fix link formatting issue in TextField/README.md

Co-authored-by: Genevieve Bulger <genevieve.bulger@shopify.com>
alex-page pushed a commit that referenced this pull request Aug 25, 2021
* Upgrade to node v12 (#4191)

* Move to node v12

* Bump merge-deep from 3.0.2 to 3.0.3 (#4254)

Bumps [merge-deep](https://github.com/jonschlinkert/merge-deep) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/jonschlinkert/merge-deep/releases)
- [Commits](jonschlinkert/merge-deep@3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: merge-deep
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws in /examples/create-react-app-ts-react-testing (#4242)

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws from 6.2.1 to 6.2.2 in /examples/create-react-app (#4241)

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws from 6.2.1 to 6.2.2 in /examples/webpack (#4240)

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update UNRELEASED.md

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump react and react-dom to v16.14.0 (#4279)

Co-authored-by: Ben Scott <227292+BPScott@users.noreply.github.com>

* [TextField] Make autoComplete prop a required string (#4267)

* Require autoComplete prop on TextField

* switch to autoComplete="off" as default

* Adding off recommendation.

* Fix link formatting issue in TextField/README.md

Co-authored-by: Genevieve Bulger <genevieve.bulger@shopify.com>

* Update browserslist to match shopify/browserslist-config v3.0.0 (#4304)

- Desktop Safari version is "last 3 safari versions" - mapping to
  Safari 13.1
- ios Safari version is "ios >= 13.4" - mapping to ios_saf 13.4-13.7

* [AutoComplete] Rebuild autocomplete internals to use new accessible components (#3910)

* Rebuild AutoComplete internals to fix accessibility issues

 - Replace internals with new combobox and list box
 - Add support for legacy combobox
 - Allow TextField and Checkbox to leverage new combobox
 - Include additional test coverage for autocomplete and new components

Co-authored-by: Andrew Musgrave <andrew.musgrave@shopify.com>
Co-authored-by: Daniel Leroux <daniel.leroux@shopify.com>

* Fix some accessibility warnings on listbox stories

* Remove listbox section example

Co-authored-by: Andrew Musgrave <andrew.musgrave@shopify.com>
Co-authored-by: Daniel Leroux <daniel.leroux@shopify.com>

Co-authored-by: Alex Page <alex@alexpage.com.au>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ben Scott <227292+BPScott@users.noreply.github.com>
Co-authored-by: Andrew McGoveran <andrew.mcgoveran@shopify.com>
Co-authored-by: Genevieve Bulger <genevieve.bulger@shopify.com>
Co-authored-by: Andrew Musgrave <andrew.musgrave@shopify.com>
Co-authored-by: Daniel Leroux <daniel.leroux@shopify.com>
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