From 44d62c153ebe41dcf4e7f5643b0e23b59f743451 Mon Sep 17 00:00:00 2001 From: Emma Hamilton Date: Thu, 9 Jul 2026 13:39:53 +1000 Subject: [PATCH] Remove warning about placeholder without description --- .changeset/rotten-guests-tickle.md | 5 +++++ .../pkg/src/text-field/test/TextField.test.tsx | 12 ------------ .../pkg/src/text-field/validateTextFieldProps.ts | 8 -------- 3 files changed, 5 insertions(+), 20 deletions(-) create mode 100644 .changeset/rotten-guests-tickle.md diff --git a/.changeset/rotten-guests-tickle.md b/.changeset/rotten-guests-tickle.md new file mode 100644 index 000000000..5f0159533 --- /dev/null +++ b/.changeset/rotten-guests-tickle.md @@ -0,0 +1,5 @@ +--- +'@keystar/ui': patch +--- + +Remove warning about placeholder without description diff --git a/design-system/pkg/src/text-field/test/TextField.test.tsx b/design-system/pkg/src/text-field/test/TextField.test.tsx index e3c7ead74..bfcd9f957 100644 --- a/design-system/pkg/src/text-field/test/TextField.test.tsx +++ b/design-system/pkg/src/text-field/test/TextField.test.tsx @@ -48,18 +48,6 @@ describe('text-field/TextField', () => { expect(ref.current).toBe(field); }); - it('should render with placeholder, but show warning', () => { - const spy = jest.spyOn(console, 'warn').mockImplementation(() => {}); - const { getByTestId } = renderTextField({ placeholder: inputText }); - const field = getByTestId(testId); - - expect(field).toHaveAttribute('placeholder', inputText); - expect(console.warn).toHaveBeenCalledWith( - 'Warning: Placeholder text is not accessible. Use the `description` prop to provide information that will aid user input.' - ); - - spy.mockRestore(); - }); it('calls onChange when text changes', async () => { const { getByRole } = renderTextField({ onBlur, onChange, onFocus }); diff --git a/design-system/pkg/src/text-field/validateTextFieldProps.ts b/design-system/pkg/src/text-field/validateTextFieldProps.ts index 9314d5b1f..45b052d1d 100644 --- a/design-system/pkg/src/text-field/validateTextFieldProps.ts +++ b/design-system/pkg/src/text-field/validateTextFieldProps.ts @@ -1,15 +1,7 @@ -import { warning } from 'emery'; - import { validateFieldProps } from '@keystar/ui/field'; import { TextFieldProps } from './types'; export function validateTextFieldProps(props: T): T { - // warn if `placeholder` is used without a `description` present - warning( - !props.placeholder || !!props.description, - 'Placeholder text is not accessible. Use the `description` prop to provide information that will aid user input.' - ); - return validateFieldProps(props); }