Skip to content

Commit fb3645d

Browse files
committed
Fix the bug allowing users to remove selected options when disabled
1 parent 698ecdc commit fb3645d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/chakra-components/containers.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ export const SelectContainer = <
3030
const initialSx: CSSObject = {
3131
position: "relative",
3232
direction: isRtl ? "rtl" : undefined,
33-
// When disabled, react-select sets the pointer-state to none which prevents
34-
// the `not-allowed` cursor style from chakra from getting applied to the
35-
// Control when it is disabled
36-
pointerEvents: "auto",
33+
...(isDisabled ? { cursor: "not-allowed" } : {}),
3734
};
3835

3936
const sx = chakraStyles?.container

src/chakra-components/control.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const Control = <
5959
overflow: "hidden",
6060
height: "auto",
6161
minHeight: heights[size || "md"],
62+
...(isDisabled ? { pointerEvents: "none" } : {}),
6263
};
6364

6465
const sx = chakraStyles?.control

0 commit comments

Comments
 (0)