Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
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
5 changes: 5 additions & 0 deletions .changeset/brave-dancers-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': minor
---

Added support for disabling 1Password integration in `TextField`
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export function CreateViewModal({
)
: undefined
}
disable1Password
/>
</div>
</FormLayout>
Expand Down
16 changes: 16 additions & 0 deletions polaris-react/src/components/TextField/TextField.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -866,3 +866,19 @@ export function WithFormSubmit() {
</VerticalStack>
);
}

export function With1PasswordDisabled() {
const [value, setValue] = useState('Jaded Pixel');

const handleChange = useCallback((newValue) => setValue(newValue), []);

return (
<TextField
label="Store name"
value={value}
onChange={handleChange}
autoComplete="off"
disable1Password
/>
);
}
4 changes: 4 additions & 0 deletions polaris-react/src/components/TextField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ interface NonMutuallyExclusiveProps {
onBlur?(event?: React.FocusEvent): void;
/** Removes the border around the input. Used in the IndexFilters component. */
borderless?: boolean;
/** Disables the 1password extension on the text field */
disable1Password?: boolean;
}

export type MutuallyExclusiveSelectionProps =
Expand Down Expand Up @@ -239,6 +241,7 @@ export function TextField({
onFocus,
onBlur,
borderless,
disable1Password,
}: TextFieldProps) {
const i18n = useI18n();
const [height, setHeight] = useState<number | null>(null);
Expand Down Expand Up @@ -556,6 +559,7 @@ export function TextField({
onKeyDown: handleKeyDown,
onChange: !suggestion ? handleChange : undefined,
onInput: suggestion ? handleChange : undefined,
'data-1p-ignore': disable1Password || undefined,
});

const inputWithVerticalContentMarkup = verticalContent ? (
Expand Down
15 changes: 15 additions & 0 deletions polaris-react/src/components/TextField/tests/TextField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,21 @@ describe('<TextField />', () => {
});
});

it('adds the data-1p-ignore prop if disable1Password is set', () => {
const textField = mountWithApp(
<TextField
label="TextField"
onChange={noop}
autoComplete="off"
disable1Password
/>,
);

expect(textField).toContainReactComponent('input', {
'data-1p-ignore': true,
} as any);
});

describe('click events', () => {
it('bubbles up to the parent element when it occurs in the input', () => {
const onClick = jest.fn();
Expand Down