diff --git a/src/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.js b/src/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.js index 494bc8b2..4fa45745 100644 --- a/src/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.js +++ b/src/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.js @@ -7,7 +7,6 @@ import { Container, Dropdown, DropdownList, - DropdownItem, DropdownItemSelectable, TextItalic } from './TextInputWithDropdown.style'; @@ -66,6 +65,12 @@ const TextInputWithDropdown = React.forwardRef( }; }, [options.length, forceClosed, onChange]); + const closeDropdown = () => { + console.log('handleDropdownInstructionClick'); + setForceClosed(true); + setActiveOption(-1); + }; + // Reset forceClosed when options change useEffect(() => { setForceClosed(false); @@ -112,6 +117,7 @@ const TextInputWithDropdown = React.forwardRef( onSelect, dropdownInstruction, activeOption, + closeDropdown, resetActiveOption: () => setActiveOption(-1) }; @@ -144,6 +150,7 @@ const Options = React.forwardRef(({ dropdownInstruction, onSelect, activeOption, + closeDropdown, resetActiveOption, ...rest }, ref) => { @@ -170,9 +177,16 @@ const Options = React.forwardRef(({ } > {dropdownInstruction && ( - - {dropdownInstruction} - + + + {dropdownInstruction} + + )} {options.map((option, index) => (