Skip to content

Commit

Permalink
fix: add condition to avoid list from closing when target is an image
Browse files Browse the repository at this point in the history
  • Loading branch information
jesrodri committed Oct 6, 2022
1 parent 4043b0e commit aacbfb1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/mui-base/src/SelectUnstyled/useSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ function useSelect<TValue>(props: UseSelectParameters<TValue>) {
const createHandleButtonClick =
(otherHandlers?: Record<string, React.EventHandler<any>>) => (event: React.MouseEvent) => {
otherHandlers?.onClick?.(event);
if (!event.defaultPrevented && !ignoreClick.current) {
const isImage = event.target instanceof HTMLImageElement;
if (!event.defaultPrevented && !ignoreClick.current && !isImage) {
onOpenChange?.(!open);
}

Expand Down

0 comments on commit aacbfb1

Please sign in to comment.