From 8ed4d30416d8859080da6159947ed09304b573e5 Mon Sep 17 00:00:00 2001 From: Ferit Date: Sat, 24 Oct 2026 23:01:19 +0300 Subject: [PATCH 1/2] fix: merge classNames.root with popupClassName and styles.root with popupStyle --- src/Tooltip.tsx | 4 ++-- tests/index.test.tsx | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Tooltip.tsx b/src/Tooltip.tsx index fc67dcb..7608057 100644 --- a/src/Tooltip.tsx +++ b/src/Tooltip.tsx @@ -133,7 +133,6 @@ const Tooltip = React.forwardRef((props, ref) => { // ========================= Render ========================= return ( ((props, ref) => { defaultPopupVisible={defaultVisible} autoDestroy={destroyOnHidden} mouseLeaveDelay={mouseLeaveDelay} - popupStyle={styles?.root} mouseEnterDelay={mouseEnterDelay} arrow={mergedArrow} uniqueContainerClassName={classNames?.uniqueContainer} uniqueContainerStyle={styles?.uniqueContainer} {...extraProps} + popupClassName={clsx(classNames?.root, extraProps.popupClassName)} + popupStyle={{ ...styles?.root, ...extraProps.popupStyle }} > {getChildren} diff --git a/tests/index.test.tsx b/tests/index.test.tsx index e4af8bf..6919e36 100644 --- a/tests/index.test.tsx +++ b/tests/index.test.tsx @@ -431,6 +431,29 @@ describe('rc-tooltip', () => { expect(tooltipArrowElement).toHaveStyle({ borderColor: 'green' }); }); + it('should merge classNames.root and popupClassName, and styles.root and popupStyle', () => { + const { container } = render( + content} + visible + popupClassName="legacy-popup" + classNames={{ root: 'semantic-root' }} + popupStyle={{ color: 'red' }} + styles={{ root: { backgroundColor: 'blue' } }} + > + target + , + ); + + const tooltipElement = container.querySelector('.rc-tooltip') as HTMLElement; + expect(tooltipElement).toHaveClass('legacy-popup'); + expect(tooltipElement).toHaveClass('semantic-root'); + expect(tooltipElement).toHaveStyle({ + color: 'red', + backgroundColor: 'blue', + }); + }); + it('should work with partial classNames and styles', () => { const partialClassNames = { container: 'custom-container', From 97982f4143a2387d255ccf428d236d66cfb6b135 Mon Sep 17 00:00:00 2001 From: Ferit Date: Tue, 27 Oct 2026 01:29:59 +0200 Subject: [PATCH 2/2] fix(types): expose legacy popup style and class props --- src/Tooltip.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tooltip.tsx b/src/Tooltip.tsx index 7608057..c4948aa 100644 --- a/src/Tooltip.tsx +++ b/src/Tooltip.tsx @@ -26,6 +26,8 @@ export interface TooltipProps extends Pick< | 'prefixCls' | 'forceRender' | 'popupVisible' + | 'popupClassName' + | 'popupStyle' > { children: React.ReactElement; // Style