diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx index f4644dc38e..d367d519c7 100644 --- a/components/breadcrumb/BreadcrumbItem.tsx +++ b/components/breadcrumb/BreadcrumbItem.tsx @@ -48,8 +48,14 @@ const BreadcrumbItem: CompoundedComponent = (props) => { /** If overlay is have Wrap a Dropdown */ const renderBreadcrumbNode = (breadcrumbItem: React.ReactNode) => { if (menu || overlay) { + const mergeDropDownProps: DropdownProps = { + ...dropdownProps, + }; + if ('overlay' in props) { + mergeDropDownProps.overlay = overlay; + } return ( - + {breadcrumbItem} diff --git a/components/breadcrumb/__tests__/Breadcrumb.test.tsx b/components/breadcrumb/__tests__/Breadcrumb.test.tsx index 598b33591b..b7b88845cc 100644 --- a/components/breadcrumb/__tests__/Breadcrumb.test.tsx +++ b/components/breadcrumb/__tests__/Breadcrumb.test.tsx @@ -46,6 +46,30 @@ describe('Breadcrumb', () => { ); }); + // https://github.com/ant-design/ant-design/issues/40204 + it('wrong overlay deprecation warning in Dropdown', () => { + const items = [ + { + key: '1', + label: ( + + General + + ), + }, + ]; + render( + + + General + + , + ); + expect(errorSpy).not.toHaveBeenCalledWith( + 'Warning: [antd: Dropdown] `overlay` is deprecated. Please use `menu` instead.', + ); + }); + // https://github.com/ant-design/ant-design/issues/5015 it('should allow Breadcrumb.Item is null or undefined', () => { const { asFragment } = render(