-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[TextField] Make autoComplete prop a required string #4267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 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 */ |
There was a problem hiding this comment.
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
|
This will require a changelog entry to |
c08d790 to
d2e9084
Compare
size-limit report
|
d2e9084 to
d6c81a4
Compare
b6cbd09 to
6e89000
Compare
| 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'); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
6e89000 to
b604ebf
Compare
* 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>
* 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>
* 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>
* 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>
* 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>
WHY are these changes introduced?
Fixes https://github.com/Shopify/core-issues/issues/26319
Makes
autoCompletea required prop on theTextFieldcomponent 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:🎩 checklist
README.mdwith documentation changes