diff --git a/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap
index 74e30e6b48..556288baa7 100644
--- a/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap
+++ b/components/dropdown/__tests__/__snapshots__/demo-extend.test.ts.snap
@@ -8194,6 +8194,292 @@ exports[`renders ./components/dropdown/demo/placement.md extend context correctl
`;
+exports[`renders ./components/dropdown/demo/render-panel.md extend context correctly 1`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`;
+
exports[`renders ./components/dropdown/demo/selectable.md extend context correctly 1`] = `
Array [
`;
+exports[`renders ./components/dropdown/demo/render-panel.md correctly 1`] = `
+
+
+
+`;
+
exports[`renders ./components/dropdown/demo/selectable.md correctly 1`] = `
+ 1st menu item
+
+ ),
+ },
+ {
+ key: '2',
+ label: (
+
+ 2nd menu item (disabled)
+
+ ),
+ icon: ,
+ disabled: true,
+ },
+ {
+ key: '3',
+ label: (
+
+ 3rd menu item (disabled)
+
+ ),
+ disabled: true,
+ },
+ {
+ key: '4',
+ danger: true,
+ label: 'a danger item',
+ },
+ ]}
+ />
+);
+
+const App: React.FC = () => ;
+
+export default App;
+```
diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx
index a05d848990..81f6f2f2f9 100644
--- a/components/dropdown/dropdown.tsx
+++ b/components/dropdown/dropdown.tsx
@@ -6,6 +6,7 @@ import useMergedState from 'rc-util/lib/hooks/useMergedState';
import * as React from 'react';
import { ConfigContext } from '../config-provider';
import { OverrideProvider } from '../menu/OverrideContext';
+import genPurePanel from '../select/PurePanel';
import getPlacements from '../_util/placements';
import { cloneElement } from '../_util/reactNode';
import { tuple } from '../_util/type';
@@ -71,6 +72,7 @@ export interface DropdownProps {
interface DropdownInterface extends React.FC {
Button: typeof DropdownButton;
+ _InternalPanelDoNotUseOrYouWillBeFired: typeof WrapPurePanel;
}
const Dropdown: DropdownInterface = props => {
@@ -238,4 +240,16 @@ Dropdown.defaultProps = {
mouseLeaveDelay: 0.1,
};
+// We don't care debug panel
+const PurePanel = genPurePanel(Dropdown, 'dropdown', prefixCls => prefixCls);
+
+/* istanbul ignore next */
+const WrapPurePanel = (props: DropdownProps) => (
+
+
+
+);
+
+Dropdown._InternalPanelDoNotUseOrYouWillBeFired = WrapPurePanel;
+
export default Dropdown;
diff --git a/components/select/PurePanel.tsx b/components/select/PurePanel.tsx
index 03dc718b2b..408344e958 100644
--- a/components/select/PurePanel.tsx
+++ b/components/select/PurePanel.tsx
@@ -10,6 +10,7 @@ export interface BaseProps {
export default function genPurePanel(
Component: any,
defaultPrefixCls?: string,
+ getDropdownCls?: (prefixCls: string) => string,
) {
return function PurePanel(props: ComponentProps) {
const { prefixCls: customizePrefixCls, style } = props;
@@ -31,7 +32,10 @@ export default function genPurePanel(
});
const interval = setInterval(() => {
- const popup = holderRef.current?.querySelector(`.${prefixCls}-dropdown`);
+ const dropdownCls = getDropdownCls
+ ? `.${getDropdownCls(prefixCls)}`
+ : `.${prefixCls}-dropdown`;
+ const popup = holderRef.current?.querySelector(dropdownCls);
if (popup) {
clearInterval(interval);