File tree Expand file tree Collapse file tree
packages/pluggableWidgets/combobox-web/src/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ export function MultiSelection({
4040 const inputLabel = getInputLabel ( options . inputId ) ;
4141 const errorId = getValidationErrorId ( options . inputId ) ;
4242 const hasLabel = useMemo ( ( ) => Boolean ( inputLabel ) , [ inputLabel ] ) ;
43+ const labelText = inputLabel ?. textContent ?. trim ( ) || "" ;
4344 const inputProps = getInputProps ( {
4445 ...getDropdownProps (
4546 {
@@ -140,9 +141,19 @@ export function MultiSelection({
140141 tabIndex = { tabIndex }
141142 placeholder = " "
142143 { ...inputProps }
143- aria-labelledby = { hasLabel ? inputProps [ "aria-labelledby" ] : undefined }
144+ aria-label = {
145+ ! isOpen && selectedItems . length > 0 && hasLabel
146+ ? `${ labelText } , ${ selectedItems . map ( id => selector . caption . get ( id ) ) . join ( ", " ) } `
147+ : ! isOpen && selectedItems . length > 0
148+ ? selectedItems . map ( id => selector . caption . get ( id ) ) . join ( ", " )
149+ : ! hasLabel
150+ ? options . ariaLabel
151+ : undefined
152+ }
153+ aria-labelledby = { hasLabel && isOpen ? inputProps [ "aria-labelledby" ] : undefined }
144154 aria-describedby = { selector . validation ? errorId : undefined }
145155 aria-invalid = { selector . validation ? true : undefined }
156+ aria-busy = { selector . options . isLoading || undefined }
146157 />
147158 < InputPlaceholder isEmpty = { selectedItems . length <= 0 } > { memoizedselectedCaptions } </ InputPlaceholder >
148159 </ div >
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ export function SingleSelection({
6060 const inputLabel = getInputLabel ( options . inputId ) ;
6161 const errorId = getValidationErrorId ( options . inputId ) ;
6262 const hasLabel = useMemo ( ( ) => Boolean ( inputLabel ) , [ inputLabel ] ) ;
63+ const labelText = inputLabel ?. textContent ?. trim ( ) || "" ;
6364 const onInputKeyDown = useMemo < KeyboardEventHandler < HTMLInputElement > | undefined > ( ( ) => {
6465 if ( ! selector . clearable ) {
6566 return undefined ;
@@ -107,9 +108,19 @@ export function SingleSelection({
107108 tabIndex = { tabIndex }
108109 { ...inputProps }
109110 placeholder = " "
110- aria-labelledby = { hasLabel ? inputProps [ "aria-labelledby" ] : undefined }
111+ aria-label = {
112+ ! isOpen && selectedItem && hasLabel
113+ ? `${ labelText } , ${ selector . caption . get ( selectedItem ) } `
114+ : ! isOpen && selectedItem
115+ ? selector . caption . get ( selectedItem )
116+ : ! hasLabel
117+ ? options . ariaLabel
118+ : undefined
119+ }
120+ aria-labelledby = { hasLabel && isOpen ? inputProps [ "aria-labelledby" ] : undefined }
111121 aria-describedby = { selector . validation ? errorId : undefined }
112122 aria-invalid = { selector . validation ? true : undefined }
123+ aria-busy = { selector . options . isLoading || undefined }
113124 />
114125 < InputPlaceholder
115126 isEmpty = { ! selector . currentId || ! selector . caption . render ( selectedItem , "label" ) }
You can’t perform that action at this time.
0 commit comments