diff --git a/src/Form/FormAutosuggest.jsx b/src/Form/FormAutosuggest.jsx index a2ef755281..0e255d5553 100644 --- a/src/Form/FormAutosuggest.jsx +++ b/src/Form/FormAutosuggest.jsx @@ -6,7 +6,7 @@ import { v4 as uuidv4 } from 'uuid'; import { useIntl } from 'react-intl'; import { KeyboardArrowUp, KeyboardArrowDown } from '../../icons'; import Icon from '../Icon'; -import FormGroup from './FormGroup'; +import { FormGroupContextProvider, useFormGroupContext } from './FormGroupContext'; import FormControl from './FormControl'; import FormControlFeedback from './FormControlFeedback'; import IconButton from '../IconButton'; @@ -239,12 +239,18 @@ function FormAutosuggest({ setDisplayValue(e.target.value); }; + const { getControlProps } = useFormGroupContext(); + const controlProps = getControlProps(props); + return (
{`${state.dropDownItems.length} options found`}
- + 0).toString()} @@ -259,7 +265,7 @@ function FormAutosuggest({ onClick={handleClick} trailingElement={iconToggle} data-testid="autosuggest-textbox-input" - {...props} + {...controlProps} /> {helpMessage && !state.errorMessage && ( @@ -269,11 +275,11 @@ function FormAutosuggest({ )} {state.errorMessage && ( - + {errorMessageText} )} - +