Skip to content

Commit 86d2e6c

Browse files
committed
fix: enhance accessibility by adding aria attributes and correcting ValidationAlert id
1 parent 4c40b40 commit 86d2e6c

File tree

1 file changed

+3
-1
lines changed
  • packages/pluggableWidgets/checkbox-radio-selection-web/src/components/CheckboxSelection

1 file changed

+3
-1
lines changed

packages/pluggableWidgets/checkbox-radio-selection-web/src/components/CheckboxSelection/CheckboxSelection.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export function CheckboxSelection({
6060
disabled={isReadOnly}
6161
tabIndex={tabIndex}
6262
onChange={e => handleChange(optionId, e.target.checked)}
63+
aria-describedby={selector.validation ? errorId : undefined}
64+
aria-invalid={selector.validation ? true : undefined}
6365
/>
6466
<CaptionContent
6567
onClick={(e: MouseEvent<HTMLDivElement>) => {
@@ -76,7 +78,7 @@ export function CheckboxSelection({
7678
);
7779
})}
7880
{options.length === 0 && <Placeholder noOptionsText={noOptionsText} />}
79-
{validation && <ValidationAlert referenceId={errorId}>{validation}</ValidationAlert>}
81+
{validation && <ValidationAlert id={errorId}>{validation}</ValidationAlert>}
8082
</div>
8183
);
8284
}

0 commit comments

Comments
 (0)