@@ -21,7 +21,7 @@ import type { RefTriggerProps } from '../SelectTrigger';
2121import SelectTrigger from '../SelectTrigger' ;
2222import { getSeparatedContent , isValidCount } from '../utils/valueUtil' ;
2323import Polite from './Polite' ;
24- import useOpen from '../hooks/useOpen' ;
24+ import useOpen , { macroTask } from '../hooks/useOpen' ;
2525import { useEvent } from '@rc-component/util' ;
2626import type { SelectInputRef } from '../SelectInput' ;
2727import SelectInput from '../SelectInput' ;
@@ -547,8 +547,7 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
547547 useSelectTriggerControl ( getSelectElements , mergedOpen , triggerOpen , ! ! mergedComponents . root ) ;
548548
549549 // ========================== Focus / Blur ==========================
550- /** Record real focus status */
551- // const focusRef = React.useRef<boolean>(false);
550+ const internalMouseDownRef = React . useRef ( false ) ;
552551
553552 const onInternalFocus : React . FocusEventHandler < HTMLElement > = ( event ) => {
554553 setFocused ( true ) ;
@@ -565,7 +564,7 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
565564
566565 const onRootBlur = ( ) => {
567566 // Delay close should check the activeElement
568- if ( mergedOpen ) {
567+ if ( mergedOpen && ! internalMouseDownRef . current ) {
569568 triggerOpen ( false , {
570569 cancelFun : ( ) => isInside ( getSelectElements ( ) , document . activeElement as HTMLElement ) ,
571570 } ) ;
@@ -605,6 +604,11 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
605604 }
606605
607606 onMouseDown ?.( event , ...restArgs ) ;
607+
608+ internalMouseDownRef . current = true ;
609+ macroTask ( ( ) => {
610+ internalMouseDownRef . current = false ;
611+ } ) ;
608612 } ;
609613
610614 // ============================ Dropdown ============================
0 commit comments