Skip to content

Commit 6e2525c

Browse files
authored
Fix Empty Dropdown Shadow (#2755)
1 parent 243ad0a commit 6e2525c

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

  • workspaces/cost-management/plugins/cost-management/src/pages/optimizations/components

workspaces/cost-management/plugins/cost-management/src/pages/optimizations/components/ComboBox.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ export function ComboBox<
8585
FreeSolo extends boolean | undefined = undefined,
8686
>(props: ComboBoxProps<T, Multiple, DisableClearable, FreeSolo>) {
8787
const classes = useComboBoxStyles();
88-
const [_text, setText] = useState('');
88+
const [isOpen, setIsOpen] = useState(false);
89+
const [inputValue, setInputValue] = useState('');
8990

9091
return (
9192
<Box className={classes.root} pb={1} pt={1}>
@@ -94,18 +95,16 @@ export function ComboBox<
9495
</Typography>
9596
<Autocomplete<T, Multiple, DisableClearable, FreeSolo>
9697
{...props}
98+
open={isOpen && props.options.length > 0}
99+
onOpen={() => setIsOpen(true)}
100+
onClose={() => setIsOpen(false)}
101+
inputValue={inputValue}
102+
onInputChange={(_, value) => setInputValue(value)}
97103
disableCloseOnSelect={props.multiple}
98104
includeInputInList
99105
popupIcon={<ExpandMoreIcon data-testid="expand-icon" />}
100106
renderInput={params => (
101-
<TextField
102-
{...params}
103-
className={classes.input}
104-
onChange={e => {
105-
setText(e.currentTarget.value);
106-
}}
107-
variant="outlined"
108-
/>
107+
<TextField {...params} className={classes.input} variant="outlined" />
109108
)}
110109
renderOption={(option, { selected }) =>
111110
!props.freeSolo ? (

0 commit comments

Comments
 (0)