Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Use [the changelog guidelines](https://git.io/polaris-changelog-guidelines) to f

- Updated `react` and `react-dom` to version 16.14.0. This is now the minimum version of React required to use the `@shopify/polaris` library.
- Dropping support for node 10.x
- Made `autoComplete` prop in `TextField` a required string ([#4267](https://github.com/Shopify/polaris-react/pull/4267)). If you do not want the browser to autofill a user's information (for example an email input which is a customer's email, but not the email of the user who is entering the information), we recommend setting `autoComplete` to `"off"`.

### Enhancements

Expand Down
3 changes: 3 additions & 0 deletions examples/create-react-app-ts-react-testing/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,14 @@ export function App() {
label="First name"
placeholder="Tom"
onChange={handleFirstChange}
autoComplete="given-name"
/>
<TextField
value={last}
label="Last name"
placeholder="Ford"
onChange={handleLastChange}
autoComplete="family-name"
/>
</FormLayout.Group>

Expand All @@ -113,6 +115,7 @@ export function App() {
label="Email"
placeholder="example@email.com"
onChange={handleEmailChange}
autoComplete="email"
/>

<ChoiceList
Expand Down
3 changes: 3 additions & 0 deletions examples/create-react-app/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ export function App() {
label="First name"
placeholder="Tom"
onChange={handleFirstChange}
autoComplete="given-name"
/>
<TextField
value={last}
label="Last name"
placeholder="Ford"
onChange={handleLastChange}
autoComplete="family-name"
/>
</FormLayout.Group>

Expand All @@ -106,6 +108,7 @@ export function App() {
label="Email"
placeholder="example@email.com"
onChange={handleEmailChange}
autoComplete="email"
/>

<ChoiceList
Expand Down
12 changes: 6 additions & 6 deletions examples/next.js/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ export default function App() {
[],
);

const toggleConnection = useCallback(
() => {
setConnected(!connected);
},
[connected],
);
const toggleConnection = useCallback(() => {
setConnected(!connected);
}, [connected]);

const breadcrumbs = [{content: 'Sample apps'}, {content: 'next.js'}];
const primaryAction = {content: 'New product'};
Expand Down Expand Up @@ -95,12 +92,14 @@ export default function App() {
label="First name"
placeholder="Tom"
onChange={handleFirstChange}
autoComplete="given-name"
/>
<TextField
value={last}
label="Last name"
placeholder="Ford"
onChange={handleLastChange}
autoComplete="family-name"
/>
</FormLayout.Group>

Expand All @@ -109,6 +108,7 @@ export default function App() {
label="Email"
placeholder="example@email.com"
onChange={handleEmailChange}
autoComplete="email"
/>

<ChoiceList
Expand Down
12 changes: 6 additions & 6 deletions examples/webpack/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ export default function App() {
[],
);

const toggleConnection = useCallback(
() => {
setConnected(!connected);
},
[connected],
);
const toggleConnection = useCallback(() => {
setConnected(!connected);
}, [connected]);

const breadcrumbs = [{content: 'Sample apps'}, {content: 'webpack'}];
const primaryAction = {content: 'New product'};
Expand Down Expand Up @@ -95,12 +92,14 @@ export default function App() {
label="First name"
placeholder="Tom"
onChange={handleFirstChange}
autoComplete="given-name"
/>
<TextField
value={last}
label="Last name"
placeholder="Ford"
onChange={handleLastChange}
autoComplete="family-name"
/>
</FormLayout.Group>

Expand All @@ -109,6 +108,7 @@ export default function App() {
label="Email"
placeholder="example@email.com"
onChange={handleEmailChange}
autoComplete="email"
/>

<ChoiceList
Expand Down
4 changes: 4 additions & 0 deletions playground/DetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,13 @@ export function DetailsPage() {
label="Title"
value="M60-A"
onChange={() => setIsDirty(true)}
autoComplete="off"
/>
<TextField
label="Description"
value={descriptionValue}
onChange={handleChange}
autoComplete="off"
multiline
/>
</FormLayout>
Expand Down Expand Up @@ -653,11 +655,13 @@ export function DetailsPage() {
label="Subject"
value={supportSubject}
onChange={handleSubjectChange}
autoComplete="off"
/>
<TextField
label="Message"
value={supportMessage}
onChange={handleMessageChange}
autoComplete="off"
multiline
/>
</FormLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ describe('<ComboBox/>', () => {
function noop() {}

function renderTextField() {
return <TextField label="" onChange={noop} />;
return <TextField label="" onChange={noop} autoComplete="off" />;
}

function renderNodeWithId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function TextField(props: TextFieldProps) {
<BaseTextField
{...props}
role="combobox"
autoComplete={false}
autoComplete="off"
ariaAutocomplete="list"
ariaActiveDescendant={selectedOptionId}
ariaControls={comboBoxId}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Autocomplete/tests/Autocomplete.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ describe('<Autocomplete/>', () => {
function noop() {}

function renderTextField() {
return <Autocomplete.TextField label="" onChange={noop} />;
return (
<Autocomplete.TextField label="" onChange={noop} autoComplete="off" />
);
}

function handleOnSelect(this: any, updatedSelection: string[]) {
Expand Down
2 changes: 2 additions & 0 deletions src/components/ChoiceList/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ function SingleOrMultiChoiceListWithChildrenContextExample() {
labelHidden
onChange={handleTextFieldChange}
value={textFieldValue}
autoComplete="off"
/>
),
[handleTextFieldChange, textFieldValue],
Expand Down Expand Up @@ -372,6 +373,7 @@ function SingleOrMultuChoiceListWithChildrenContextWhenSelectedExample() {
labelHidden
onChange={handleTextFieldChange}
value={textFieldValue}
autoComplete="off"
/>
),
[handleTextFieldChange, textFieldValue],
Expand Down
1 change: 1 addition & 0 deletions src/components/Filters/Filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ class FiltersInner extends Component<CombinedProps, State> {
clearButton
onClearButtonClick={onQueryClear}
disabled={disabled}
autoComplete="off"
/>
)}
</ConnectedFilterControl>
Expand Down
9 changes: 9 additions & 0 deletions src/components/Filters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ function ResourceListFiltersExample() {
label="Tagged with"
value={taggedWith}
onChange={handleTaggedWithChange}
autoComplete="off"
labelHidden
/>
),
Expand Down Expand Up @@ -423,6 +424,7 @@ function DataTableFiltersExample() {
label="Tagged with"
value={taggedWith}
onChange={handleTaggedWithChange}
autoComplete="off"
labelHidden
/>
),
Expand Down Expand Up @@ -555,6 +557,7 @@ function FiltersExample() {
label="Tagged with"
value={taggedWith}
onChange={handleTaggedWithChange}
autoComplete="off"
labelHidden
/>
),
Expand Down Expand Up @@ -681,6 +684,7 @@ function DisableAllFiltersExample() {
label="Tagged with"
value={taggedWith}
onChange={handleTaggedWithChange}
autoComplete="off"
labelHidden
/>
),
Expand Down Expand Up @@ -816,6 +820,7 @@ function DisableSomeFiltersExample() {
label="Tagged with"
value={taggedWith}
onChange={handleTaggedWithChange}
autoComplete="off"
labelHidden
/>
),
Expand All @@ -829,6 +834,7 @@ function DisableSomeFiltersExample() {
label="Vendor"
value={vendor}
onChange={handleVendorChange}
autoComplete="off"
labelHidden
/>
),
Expand Down Expand Up @@ -960,6 +966,7 @@ function Playground() {
label="Tagged with"
value={taggedWith}
onChange={handleTaggedWithChange}
autoComplete="off"
labelHidden
/>
),
Expand Down Expand Up @@ -1131,6 +1138,7 @@ function ResourceListFiltersExample() {
label="Tagged with"
value={taggedWith}
onChange={handleTaggedWithChange}
autoComplete="off"
labelHidden
/>
),
Expand Down Expand Up @@ -1331,6 +1339,7 @@ function ResourceListFiltersExample() {
label="Tagged with"
value={taggedWith}
onChange={handleTaggedWithChange}
autoComplete="off"
labelHidden
/>
),
Expand Down
2 changes: 2 additions & 0 deletions src/components/Form/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function FormOnSubmitExample() {
onChange={handleEmailChange}
label="Email"
type="email"
autoComplete="email"
helpText={
<span>
We’ll use this email address to inform you on future changes to
Expand Down Expand Up @@ -100,6 +101,7 @@ function FormWithoutNativeValidationExample() {
onChange={handleUrlChange}
label="App URL"
type="url"
autoComplete="off"
/>

<Button submit>Submit</Button>
Expand Down
31 changes: 23 additions & 8 deletions src/components/FormLayout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ Use to stack form fields vertically, which makes them easier to scan and complet

```jsx
<FormLayout>
<TextField label="Store name" onChange={() => {}} />
<TextField type="email" label="Account email" onChange={() => {}} />
<TextField label="Store name" onChange={() => {}} autoComplete="off" />
<TextField
type="email"
label="Account email"
onChange={() => {}}
autoComplete="email"
/>
</FormLayout>
```

Expand All @@ -130,8 +135,18 @@ Field groups will wrap automatically on smaller screens.
```jsx
<FormLayout>
<FormLayout.Group>
<TextField type="number" label="Minimum order" onChange={() => {}} />
<TextField type="number" label="Maximum order" onChange={() => {}} />
<TextField
type="number"
label="Minimum order"
onChange={() => {}}
autoComplete="off"
/>
<TextField
type="number"
label="Maximum order"
onChange={() => {}}
autoComplete="off"
/>
</FormLayout.Group>
</FormLayout>
```
Expand All @@ -157,10 +172,10 @@ For very short inputs, the width of the inputs may be reduced in order to fit mo
```jsx
<FormLayout>
<FormLayout.Group condensed>
<TextField label="Length" onChange={() => {}} />
<TextField label="Width" onChange={() => {}} />
<TextField label="Height" onChange={() => {}} />
<TextField label="Unit" onChange={() => {}} />
<TextField label="Length" onChange={() => {}} autoComplete="off" />
<TextField label="Width" onChange={() => {}} autoComplete="off" />
<TextField label="Height" onChange={() => {}} autoComplete="off" />
<TextField label="Unit" onChange={() => {}} autoComplete="off" />
</FormLayout.Group>
</FormLayout>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('<Group />', () => {
let item: any;

beforeAll(() => {
children = <TextField onChange={noop} label="test" />;
children = <TextField onChange={noop} label="test" autoComplete="off" />;
title = 'Title';
helpText = 'Help text';
item = mountWithAppProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {Item} from '../Item';

describe('<Item />', () => {
it('renders its children', () => {
const children = <TextField onChange={noop} label="test" />;
const children = (
<TextField onChange={noop} label="test" autoComplete="off" />
);
const item = mountWithAppProvider(<Item>{children}</Item>);
expect(item.contains(children)).toBe(true);
});
Expand Down
4 changes: 3 additions & 1 deletion src/components/FormLayout/tests/FormLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {FormLayout} from '../FormLayout';

describe('<FormLayout />', () => {
it('renders its children', () => {
const children = <TextField onChange={noop} label="test" />;
const children = (
<TextField onChange={noop} label="test" autoComplete="off" />
);
const formLayout = mountWithAppProvider(
<FormLayout>{children}</FormLayout>,
);
Expand Down
Loading