diff --git a/.changeset/light-frogs-leave.md b/.changeset/light-frogs-leave.md new file mode 100644 index 00000000000..4351a1c1c5a --- /dev/null +++ b/.changeset/light-frogs-leave.md @@ -0,0 +1,7 @@ +--- +'@primer/react': patch +--- + +TextInput, Textarea: Does not pass `aria-required` attribute to input or textarea if it is undefined. This fixes some tests that were breaking in dotcom. + + diff --git a/src/TextInput/TextInput.tsx b/src/TextInput/TextInput.tsx index 5250f510b6e..fe0848446ea 100644 --- a/src/TextInput/TextInput.tsx +++ b/src/TextInput/TextInput.tsx @@ -144,7 +144,7 @@ const TextInput = React.forwardRef( onFocus={handleInputFocus} onBlur={handleInputBlur} type={type} - aria-required={required ? 'true' : 'false'} + aria-required={required} {...inputProps} data-component="input" /> diff --git a/src/Textarea/Textarea.tsx b/src/Textarea/Textarea.tsx index 669e595c7d5..944d2715c25 100644 --- a/src/Textarea/Textarea.tsx +++ b/src/Textarea/Textarea.tsx @@ -92,7 +92,7 @@ const Textarea = React.forwardRef(