From 529c7137b0aa9bac51b6ec83847c94e7e358cab3 Mon Sep 17 00:00:00 2001 From: melloware Date: Thu, 12 May 2022 09:41:29 -0400 Subject: [PATCH 1/2] Fix #2878: Tooltip global respect data-pr-position --- components/lib/tooltip/Tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/lib/tooltip/Tooltip.js b/components/lib/tooltip/Tooltip.js index c6e7bf3007..c7433f1b23 100644 --- a/components/lib/tooltip/Tooltip.js +++ b/components/lib/tooltip/Tooltip.js @@ -172,7 +172,7 @@ export const Tooltip = React.memo(React.forwardRef((props, ref) => { DomHandler.removeClass(elementRef.current, 'p-tooltip-active'); setVisibleState(false); - setPositionState(props.position); + setPositionState(getPosition(currentTargetRef.current)); currentTargetRef.current = null; containerSize.current = null; allowHide.current = true; @@ -435,7 +435,7 @@ export const Tooltip = React.memo(React.forwardRef((props, ref) => { const createElement = () => { const otherProps = ObjectUtils.findDiffKeys(props, Tooltip.defaultProps); const tooltipClassName = classNames('p-tooltip p-component', { - [`p-tooltip-${positionState}`]: true + [`p-tooltip-${getPosition(currentTargetRef.current)}`]: true }, props.className); const empty = isTargetContentEmpty(currentTargetRef.current); From 175dc06ea7119bb03dd3a8b4497781e23cf4c504 Mon Sep 17 00:00:00 2001 From: Melloware Date: Mon, 30 May 2022 11:15:13 -0400 Subject: [PATCH 2/2] Update Tooltip.js --- components/lib/tooltip/Tooltip.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/lib/tooltip/Tooltip.js b/components/lib/tooltip/Tooltip.js index b40b6fc355..9a30ba6c50 100644 --- a/components/lib/tooltip/Tooltip.js +++ b/components/lib/tooltip/Tooltip.js @@ -173,7 +173,6 @@ export const Tooltip = React.memo(React.forwardRef((props, ref) => { setVisibleState(false); setPositionState(getPosition(currentTargetRef.current)); setClassNameState(''); - currentTargetRef.current = null; containerSize.current = null; allowHide.current = true; @@ -438,7 +437,6 @@ export const Tooltip = React.memo(React.forwardRef((props, ref) => { const tooltipClassName = classNames('p-tooltip p-component', { [`p-tooltip-${getPosition(currentTargetRef.current)}`]: true }, props.className, classNameState); - const empty = isTargetContentEmpty(currentTargetRef.current); return (