@@ -4,6 +4,7 @@ import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
44import useMergedState from '@rc-component/util/lib/hooks/useMergedState' ;
55import isMobile from '@rc-component/util/lib/isMobile' ;
66import { useComposeRef } from '@rc-component/util/lib/ref' ;
7+ import { getDOM } from '@rc-component/util/lib/Dom/findDOMNode' ;
78import type { ScrollConfig , ScrollTo } from 'rc-virtual-list/lib/List' ;
89import * as React from 'react' ;
910import { useAllowClear } from '../hooks/useAllowClear' ;
@@ -330,11 +331,11 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
330331
331332 // ============================== Refs ==============================
332333 const containerRef = React . useRef < HTMLDivElement > ( null ) ;
333- const selectorDomRef = React . useRef < HTMLDivElement > ( null ) ;
334334 const triggerRef = React . useRef < RefTriggerProps > ( null ) ;
335335 const selectorRef = React . useRef < RefSelectorProps > ( null ) ;
336336 const listRef = React . useRef < RefOptionListProps > ( null ) ;
337337 const blurRef = React . useRef < boolean > ( false ) ;
338+ const customDomRef = React . useRef < HTMLElement > ( null ) ;
338339
339340 /** Used for component focused management */
340341 const [ mockFocused , setMockFocused , cancelSetMockFocused ] = useDelayReset ( ) ;
@@ -344,7 +345,10 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
344345 focus : selectorRef . current ?. focus ,
345346 blur : selectorRef . current ?. blur ,
346347 scrollTo : ( arg ) => listRef . current ?. scrollTo ( arg ) ,
347- nativeElement : containerRef . current || selectorDomRef . current ,
348+ nativeElement :
349+ containerRef . current ||
350+ selectorRef . current ?. nativeElement ||
351+ ( getDOM ( customDomRef . current ) as HTMLElement ) ,
348352 } ) ) ;
349353
350354 // ========================== Search Value ==========================
@@ -368,7 +372,7 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
368372 typeof getRawInputElement === 'function' && getRawInputElement ( ) ;
369373
370374 const customizeRawInputRef = useComposeRef < HTMLElement > (
371- selectorDomRef ,
375+ customDomRef ,
372376 customizeRawInputElement ?. props ?. ref ,
373377 ) ;
374378
@@ -808,12 +812,6 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
808812 builtinPlacements = { builtinPlacements }
809813 getPopupContainer = { getPopupContainer }
810814 empty = { emptyOptions }
811- getTriggerDOMNode = { ( node ) =>
812- // TODO: This is workaround and should be removed in `rc-select`
813- // And use new standard `nativeElement` for ref.
814- // But we should update `rc-resize-observer` first.
815- selectorDomRef . current || node
816- }
817815 onPopupVisibleChange = { onTriggerVisibleChange }
818816 onPopupMouseEnter = { onPopupMouseEnter }
819817 >
@@ -826,7 +824,6 @@ const BaseSelect = React.forwardRef<BaseSelectRef, BaseSelectProps>((props, ref)
826824 { ...props }
827825 prefixClassName = { classNames ?. prefix }
828826 prefixStyle = { styles ?. prefix }
829- domRef = { selectorDomRef }
830827 prefixCls = { prefixCls }
831828 inputElement = { customizeInputElement }
832829 ref = { selectorRef }
0 commit comments