Skip to content

Commit

Permalink
fix: ensure simpleSelect mouseDown event deactivates normally
Browse files Browse the repository at this point in the history
Closes #1045
  • Loading branch information
Skaiir committed Feb 15, 2024
1 parent 4226bd2 commit 69dae31
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ export function SimpleSelect(props) {
}, [ disabled, isDropdownExpanded, loadState, readonly, value ]);

const onMouseDown = useCallback((e) => {

const input = inputRef.current;

if (disabled || !input) {
return;
}

setIsDropdownExpanded(!isDropdownExpanded);

if (isDropdownExpanded) {
Expand All @@ -66,7 +72,7 @@ export function SimpleSelect(props) {
}

e.preventDefault();
}, [ isDropdownExpanded ]);
}, [ disabled, isDropdownExpanded ]);

const initialFocusIndex = useMemo(() => value && findIndex(options, (o) => o.value === value) || 0, [ options, value ]);

Expand Down

0 comments on commit 69dae31

Please sign in to comment.