File tree Expand file tree Collapse file tree 4 files changed +11
-8
lines changed
packages/pluggableWidgets/combobox-web/src Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export default function Combobox(props: ComboboxContainerProps): ReactElement {
2525 noOptionsText : props . noOptionsText ?. value ,
2626 readOnlyStyle : props . readOnlyStyle ,
2727 ariaRequired : props . ariaRequired ,
28+ ariaLabel : props . ariaLabel ?. value ,
2829 a11yConfig : {
2930 ariaLabels : {
3031 clearSelection : props . clearButtonAriaLabel ?. value ?? "" ,
Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ export function MultiSelection({
3737 const inputRef = useRef < HTMLInputElement > ( null ) ;
3838 const isSelectedItemsBoxStyle = selector . selectedItemsStyle === "boxes" ;
3939 const isOptionsSelected = selector . isOptionsSelected ( ) ;
40+ const inputLabel = getInputLabel ( options . inputId ) ;
41+ const hasLabel = useMemo ( ( ) => Boolean ( inputLabel ) , [ inputLabel ] ) ;
4042 const inputProps = getInputProps ( {
4143 ...getDropdownProps (
4244 {
@@ -62,12 +64,10 @@ export function MultiSelection({
6264 } ,
6365 disabled : selector . readOnly ,
6466 readOnly : selector . options . filterType === "none" ,
65- "aria-required" : ariaRequired . value
67+ "aria-required" : ariaRequired . value ,
68+ "aria-label" : ! hasLabel && options . ariaLabel ? options . ariaLabel : undefined
6669 } ) ;
6770
68- const inputLabel = getInputLabel ( inputProps . id ) ;
69- const hasLabel = useMemo ( ( ) => Boolean ( inputLabel ) , [ inputLabel ] ) ;
70-
7171 const memoizedselectedCaptions = useMemo (
7272 ( ) => getSelectedCaptionsPlaceholder ( selector , selectedItems ) ,
7373 [ selector , selectedItems ]
Original file line number Diff line number Diff line change @@ -56,19 +56,20 @@ export function SingleSelection({
5656 ]
5757 ) ;
5858
59+ const inputLabel = getInputLabel ( options . inputId ) ;
60+ const hasLabel = useMemo ( ( ) => Boolean ( inputLabel ) , [ inputLabel ] ) ;
61+
5962 const inputProps = getInputProps (
6063 {
6164 disabled : selector . readOnly ,
6265 readOnly : selector . options . filterType === "none" ,
6366 ref : inputRef ,
64- "aria-required" : ariaRequired . value
67+ "aria-required" : ariaRequired . value ,
68+ "aria-label" : ! hasLabel && options . ariaLabel ? options . ariaLabel : undefined
6569 } ,
6670 { suppressRefError : true }
6771 ) ;
6872
69- const inputLabel = getInputLabel ( inputProps . id ) ;
70- const hasLabel = useMemo ( ( ) => Boolean ( inputLabel ) , [ inputLabel ] ) ;
71-
7273 return (
7374 < Fragment >
7475 < ComboboxWrapper
Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ export interface SelectionBaseProps<Selector> {
100100 menuFooterContent ?: ReactNode ;
101101 tabIndex : number ;
102102 ariaRequired : DynamicValue < boolean > ;
103+ ariaLabel ?: string ;
103104 a11yConfig : {
104105 ariaLabels : {
105106 clearSelection : string ;
You can’t perform that action at this time.
0 commit comments