Skip to content

Commit 73cec75

Browse files
authored
Merge pull request #302 from lschlesinger/v3-is-disabled-fix
Fix for V3: Prevent a selected option from being removed when isDisabled is passed
2 parents 3f31a68 + 723d0b0 commit 73cec75

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
@@ -31,10 +31,7 @@ export const SelectContainer = <
3131
const initialStyles: SystemStyleObject = {
3232
position: "relative",
3333
direction: isRtl ? "rtl" : undefined,
34-
// When disabled, react-select sets the pointer-state to none which prevents
35-
// the `not-allowed` cursor style from chakra from getting applied to the
36-
// Control when it is disabled
37-
pointerEvents: "auto",
34+
...(isDisabled ? { cursor: "not-allowed" } : {}),
3835
};
3936

4037
const sx: SystemStyleObject = chakraStyles?.container

src/chakra-components/control.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const Control = <
5050
overflow: "hidden",
5151
height: "auto",
5252
minHeight: heights[size as Size],
53+
...(isDisabled ? { pointerEvents: "none" } : {}),
5354
};
5455

5556
const sx: SystemStyleObject = chakraStyles?.control

0 commit comments

Comments
 (0)