Skip to content

Commit 928e26b

Browse files
authored
Merge pull request #2573 from opossum-tool/fix-autocomplete-end-icon-click
fix: autocomplete end-icon click opens popover
2 parents 04d9127 + 573a2af commit 928e26b

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/Frontend/Components/Autocomplete/Autocomplete.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -225,18 +225,17 @@ export function Autocomplete<
225225
}
226226

227227
return (
228-
<EndAdornmentContainer>
228+
<EndAdornmentContainer
229+
onClick={(event) => event.stopPropagation()}
230+
onMouseDown={(event) => event.stopPropagation()}
231+
>
229232
{hasClearButton && (
230-
<ClearButton
231-
{...(getClearProps() as MuiIconButtonProps)}
232-
onMouseDown={(event) => event.stopPropagation()}
233-
/>
233+
<ClearButton {...(getClearProps() as MuiIconButtonProps)} />
234234
)}
235235
{hasPopupIndicator && (
236236
<PopupIndicator
237237
popupOpen={isPopupOpen}
238238
{...(getPopupIndicatorProps() as MuiIconButtonProps)}
239-
onClick={undefined}
240239
/>
241240
)}
242241
{endAdornment}

src/Frontend/Components/IconButton/IconButton.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface IconButtonProps {
1313
tooltipPlacement?: TooltipProps['placement'];
1414
iconSx?: SxProps;
1515
containerSx?: SxProps;
16-
onClick?(): void;
16+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
1717
icon: ReactElement;
1818
disabled?: boolean;
1919
hidden?: boolean;
@@ -39,7 +39,7 @@ export function IconButton(props: IconButtonProps) {
3939
sx={props.iconSx}
4040
onClick={(event) => {
4141
event.stopPropagation();
42-
props.onClick?.();
42+
props.onClick?.(event);
4343
}}
4444
disabled={props.disabled}
4545
data-testid={props['data-testid']}

0 commit comments

Comments
 (0)