Skip to content

Commit 4c6ba23

Browse files
authored
picker reopen on edge click fixes:ant-design/ant-design#31673 (#279)
1 parent b647101 commit 4c6ba23

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Picker.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
186186
// Panel ref
187187
const panelDivRef = React.useRef<HTMLDivElement>(null);
188188
const inputDivRef = React.useRef<HTMLDivElement>(null);
189+
const containerRef = React.useRef<HTMLDivElement>(null);
189190

190191
// Real value
191192
const [mergedValue, setInnerValue] = useMergedState(null, {
@@ -294,7 +295,10 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
294295
triggerOpen,
295296
forwardKeyDown,
296297
isClickOutside: (target) =>
297-
!elementsContains([panelDivRef.current, inputDivRef.current], target as HTMLElement),
298+
!elementsContains(
299+
[panelDivRef.current, inputDivRef.current, containerRef.current],
300+
target as HTMLElement,
301+
),
298302
onSubmit: () => {
299303
if (disabledDate && disabledDate(selectedValue)) {
300304
return false;
@@ -486,6 +490,7 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
486490
direction={direction}
487491
>
488492
<div
493+
ref={containerRef}
489494
className={classNames(prefixCls, className, {
490495
[`${prefixCls}-disabled`]: disabled,
491496
[`${prefixCls}-focused`]: focused,

0 commit comments

Comments
 (0)