@@ -10,7 +10,6 @@ import type {
1010} from 'rc-trigger/lib/interface' ;
1111import Placements from './placements' ;
1212import useAccessibility from './hooks/useAccessibility' ;
13- import { composeRef , supportRef } from 'rc-util/lib/ref' ;
1413
1514export interface DropdownProps
1615 extends Pick <
@@ -70,14 +69,10 @@ function Dropdown(props: DropdownProps, ref) {
7069 const triggerRef = React . useRef ( null ) ;
7170 React . useImperativeHandle ( ref , ( ) => triggerRef . current ) ;
7271
73- const menuRef = React . useRef ( null ) ;
74- const menuClassName = `${ prefixCls } -menu` ;
75-
7672 useAccessibility ( {
7773 visible : mergedVisible ,
7874 setTriggerVisible,
7975 triggerRef,
80- menuRef,
8176 onVisibleChange : props . onVisibleChange ,
8277 autoFocus,
8378 } ) ;
@@ -95,15 +90,12 @@ function Dropdown(props: DropdownProps, ref) {
9590
9691 const onClick = ( e ) => {
9792 const { onOverlayClick } = props ;
98- const overlayProps = getOverlayElement ( ) . props ;
9993 setTriggerVisible ( false ) ;
10094
95+ console . log ( '!!!!!!!!!!!!' , onOverlayClick ) ;
10196 if ( onOverlayClick ) {
10297 onOverlayClick ( e ) ;
10398 }
104- if ( overlayProps . onClick ) {
105- overlayProps . onClick ( e ) ;
106- }
10799 } ;
108100
109101 const onVisibleChange = ( newVisible : boolean ) => {
@@ -116,23 +108,11 @@ function Dropdown(props: DropdownProps, ref) {
116108
117109 const getMenuElement = ( ) => {
118110 const overlayElement = getOverlayElement ( ) ;
119- // @ts -ignore
120- const composedMenuRef = composeRef ( menuRef , overlayElement . ref ) ;
121-
122- const extraOverlayProps = {
123- prefixCls : menuClassName ,
124- [ 'data-dropdown-inject' ] : true ,
125- onClick,
126- ref : supportRef ( overlayElement ) ? composedMenuRef : undefined ,
127- } ;
128- if ( typeof overlayElement . type === 'string' ) {
129- delete extraOverlayProps . prefixCls ;
130- delete extraOverlayProps [ 'data-dropdown-inject' ] ;
131- }
111+
132112 return (
133113 < >
134114 { arrow && < div className = { `${ prefixCls } -arrow` } /> }
135- { React . cloneElement ( overlayElement , extraOverlayProps ) }
115+ { overlayElement }
136116 </ >
137117 ) ;
138118 } ;
@@ -199,6 +179,7 @@ function Dropdown(props: DropdownProps, ref) {
199179 stretch = { getMinOverlayWidthMatchTrigger ( ) ? 'minWidth' : '' }
200180 popup = { getMenuElementOrLambda ( ) }
201181 onPopupVisibleChange = { onVisibleChange }
182+ onPopupClick = { onClick }
202183 getPopupContainer = { getPopupContainer }
203184 >
204185 { renderChildren ( ) }
0 commit comments