@@ -682,25 +682,11 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
682682 const { target } = event ;
683683 const popupElement : HTMLDivElement = triggerRef . current ?. getPopupElement ( ) ;
684684
685- console . log ( '???' ) ;
686-
687685 // We should give focus back to selector if clicked item is not focusable
688- // if (popupElement?.contains(target as HTMLElement)) {
689- // const timeoutId = setTimeout(() => {
690- // const index = activeTimeoutIds.indexOf(timeoutId);
691- // if (index !== -1) {
692- // activeTimeoutIds.splice(index, 1);
693- // }
694-
695- // cancelSetMockFocused();
696-
697- // if (!mobile && !popupElement.contains(document.activeElement)) {
698- // selectorRef.current?.focus();
699- // }
700- // });
701-
702- // activeTimeoutIds.push(timeoutId);
703- // }
686+ if ( popupElement ?. contains ( target as HTMLElement ) && triggerOpen ) {
687+ // Tell `open` not to close since it's safe in the popup
688+ triggerOpen ( true , true ) ;
689+ }
704690
705691 onMouseDown ?.( event , ...restArgs ) ;
706692 } ;
@@ -881,9 +867,6 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
881867 // </SelectTrigger>
882868 // );
883869
884- // >>> Render
885- let renderNode : React . ReactNode ;
886-
887870 // Render raw
888871 // if (customizeRawInputElement) {
889872 // renderNode = selectorNode;
@@ -907,7 +890,8 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
907890 // );
908891 // }
909892
910- renderNode = (
893+ // >>> Render
894+ let renderNode : React . ReactElement = (
911895 < SelectInput
912896 { ...restProps }
913897 // Ref
@@ -947,6 +931,39 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
947931 />
948932 ) ;
949933
934+ // const renderSelectTrigger = (childrenNode?: React.ReactElement) => (
935+ // <SelectTrigger
936+ // ref={triggerRef}
937+ // disabled={disabled}
938+ // prefixCls={prefixCls}
939+ // visible={mergedOpen}
940+ // popupElement={optionList}
941+ // animation={animation}
942+ // transitionName={transitionName}
943+ // popupStyle={popupStyle}
944+ // popupClassName={popupClassName}
945+ // direction={direction}
946+ // popupMatchSelectWidth={popupMatchSelectWidth}
947+ // popupRender={popupRender}
948+ // popupAlign={popupAlign}
949+ // placement={placement}
950+ // builtinPlacements={builtinPlacements}
951+ // getPopupContainer={getPopupContainer}
952+ // empty={emptyOptions}
953+ // // onPopupVisibleChange={onTriggerVisibleChange}
954+ // onPopupMouseEnter={onPopupMouseEnter}
955+ // >
956+ // {childrenNode}
957+ // </SelectTrigger>
958+ // );
959+
960+ // if (components.root) {
961+ // renderNode = renderSelectTrigger(renderSelectInput());
962+ // } else {
963+ // // renderNode = renderSelectInput(renderSelectTrigger());
964+ // renderNode = renderSelectInput(renderSelectTrigger(<a />));
965+ // }
966+
950967 renderNode = (
951968 < SelectTrigger
952969 ref = { triggerRef }
@@ -968,6 +985,7 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
968985 empty = { emptyOptions }
969986 // onPopupVisibleChange={onTriggerVisibleChange}
970987 onPopupMouseEnter = { onPopupMouseEnter }
988+ onPopupMouseDown = { onInternalMouseDown }
971989 >
972990 { renderNode }
973991 </ SelectTrigger >
0 commit comments