File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
packages/pluggableWidgets/checkbox-radio-selection-web/src/components Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ export function CheckboxSelection({
3030 }
3131 } ;
3232
33+ const isSingleCheckbox = options . length === 1 ;
34+
3335 return (
3436 < div
3537 className = { classNames ( "widget-checkbox-radio-selection-list" , {
@@ -39,6 +41,8 @@ export function CheckboxSelection({
3941 role = "group"
4042 aria-labelledby = { `${ inputId } -label` }
4143 aria-required = { ariaRequired ?. value }
44+ aria-describedby = { ! isSingleCheckbox && selector . validation ? errorId : undefined }
45+ aria-invalid = { ! isSingleCheckbox && selector . validation ? true : undefined }
4246 >
4347 { options . map ( ( optionId , index ) => {
4448 const isSelected = currentIds . includes ( optionId ) ;
@@ -60,8 +64,8 @@ export function CheckboxSelection({
6064 disabled = { isReadOnly }
6165 tabIndex = { tabIndex }
6266 onChange = { e => handleChange ( optionId , e . target . checked ) }
63- aria-describedby = { selector . validation ? errorId : undefined }
64- aria-invalid = { selector . validation ? true : undefined }
67+ aria-describedby = { isSingleCheckbox && selector . validation ? errorId : undefined }
68+ aria-invalid = { isSingleCheckbox && selector . validation ? true : undefined }
6569 />
6670 < CaptionContent
6771 onClick = { ( e : MouseEvent < HTMLDivElement > ) => {
Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ export function RadioSelection({
5050 role = { asSingleCheckbox ? "group" : "radiogroup" }
5151 aria-labelledby = { `${ inputId } -label` }
5252 aria-required = { ariaRequired ?. value }
53+ aria-describedby = { ! asSingleCheckbox && selector . validation ? errorId : undefined }
54+ aria-invalid = { ! asSingleCheckbox && selector . validation ? true : undefined }
5355 >
5456 { options . map ( ( optionId , index ) => {
5557 const isSelected = currentId === optionId ;
@@ -75,8 +77,8 @@ export function RadioSelection({
7577 disabled = { isReadOnly }
7678 tabIndex = { tabIndex }
7779 onChange = { handleChange }
78- aria-describedby = { selector . validation ? errorId : undefined }
79- aria-invalid = { selector . validation ? true : undefined }
80+ aria-describedby = { asSingleCheckbox && selector . validation ? errorId : undefined }
81+ aria-invalid = { asSingleCheckbox && selector . validation ? true : undefined }
8082 />
8183 </ If >
8284 < CaptionContent
You can’t perform that action at this time.
0 commit comments