File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
packages/pluggableWidgets/combobox-web/src/components Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ interface ComboboxWrapperProps extends PropsWithChildren {
1414 validation ?: string ;
1515 isLoading : boolean ;
1616 isMultiselectActive ?: boolean ;
17- inputId : string ;
17+ errorId ? : string ;
1818}
1919export const ComboboxWrapper = forwardRef (
2020 ( props : ComboboxWrapperProps , ref : RefObject < HTMLDivElement > ) : ReactElement => {
@@ -27,7 +27,7 @@ export const ComboboxWrapper = forwardRef(
2727 children,
2828 isLoading,
2929 isMultiselectActive,
30- inputId
30+ errorId
3131 } = props ;
3232 const { id, onClick } = getToggleButtonProps ( ) ;
3333
@@ -57,7 +57,7 @@ export const ComboboxWrapper = forwardRef(
5757 </ div >
5858 ) }
5959 </ div >
60- { validation && < ValidationAlert referenceId = { inputId + "-error" } > { validation } </ ValidationAlert > }
60+ { validation && < ValidationAlert referenceId = { errorId } > { validation } </ ValidationAlert > }
6161 </ Fragment >
6262 ) ;
6363 }
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ export function MultiSelection({
8686 readOnly : selector . readOnly
8787 } ) ;
8888
89+ const errorId = options . inputId ? options . inputId + "-validation-message" : undefined ;
8990 return (
9091 < Fragment >
9192 < ComboboxWrapper
@@ -96,7 +97,7 @@ export function MultiSelection({
9697 validation = { selector . validation }
9798 isLoading = { lazyLoading && selector . options . isLoading }
9899 isMultiselectActive = { selectedItems ?. length > 0 }
99- inputId = { options . inputId }
100+ errorId = { errorId }
100101 >
101102 < div
102103 className = { classNames (
@@ -140,7 +141,7 @@ export function MultiSelection({
140141 placeholder = " "
141142 { ...inputProps }
142143 aria-labelledby = { hasLabel ? inputProps [ "aria-labelledby" ] : undefined }
143- aria-describedby = { selector . validation ? options . inputId + "-error" : undefined }
144+ aria-describedby = { selector . validation ? errorId : undefined }
144145 aria-invalid = { selector . validation ? true : undefined }
145146 />
146147 < InputPlaceholder isEmpty = { selectedItems . length <= 0 } > { memoizedselectedCaptions } </ InputPlaceholder >
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export function SingleSelection({
2929 highlightedIndex
3030 } = useDownshiftSingleSelectProps ( selector , options , a11yConfig . a11yStatusMessage ) ;
3131 const inputRef = useRef < HTMLInputElement > ( null ) ;
32+ const errorId = options . inputId ? options . inputId + "-validation-message" : undefined ;
3233 const lazyLoading = selector . lazyLoading ?? false ;
3334 const { onScroll } = useLazyLoading ( {
3435 hasMoreItems : selector . options . hasMore ?? false ,
@@ -78,7 +79,7 @@ export function SingleSelection({
7879 getToggleButtonProps = { getToggleButtonProps }
7980 validation = { selector . validation }
8081 isLoading = { lazyLoading && selector . options . isLoading }
81- inputId = { options . inputId }
82+ errorId = { errorId }
8283 >
8384 < div
8485 className = { classNames ( "widget-combobox-selected-items" , {
@@ -93,7 +94,7 @@ export function SingleSelection({
9394 { ...inputProps }
9495 placeholder = " "
9596 aria-labelledby = { hasLabel ? inputProps [ "aria-labelledby" ] : undefined }
96- aria-describedby = { selector . validation ? options . inputId + "-error" : undefined }
97+ aria-describedby = { selector . validation ? errorId : undefined }
9798 aria-invalid = { selector . validation ? true : undefined }
9899 />
99100 < InputPlaceholder
You can’t perform that action at this time.
0 commit comments