Skip to content

Commit

Permalink
fix (a11y): set aria-required to the correct value
Browse files Browse the repository at this point in the history
  • Loading branch information
noa.santo committed Sep 19, 2024
1 parent 6d9e5b6 commit 453e55d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/forms/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const Checkbox = (
<div>
<CheckboxLabel>
<HiddenCheckbox
aria-required={true}
aria-required={Boolean(props.rules?.required)}
aria-describedby={errorMessage && `${props.name}-error`}
aria-labelledby={props.label && `${props.name}-label`}
aria-invalid={Boolean(errorMessage)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/text-area/text-area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const TextArea = (
</Label>
)}
<StyledTextArea
aria-required={true}
aria-required={Boolean(props.rules?.required)}
aria-describedby={errorMessage && `${props.name}-error`}
aria-invalid={Boolean(errorMessage)}
$hasError={Boolean(errorMessage)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/text-input/text-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const TextInput = (
)}
<Input
type={'text'}
aria-required={true}
aria-required={Boolean(props.rules?.required)}
aria-describedby={errorMessage && `${props.name}-error`}
aria-invalid={Boolean(errorMessage)}
$hasError={Boolean(errorMessage)}
Expand Down

0 comments on commit 453e55d

Please sign in to comment.