From 8c570cac8c74339aa1eb061709dccd7ad8559d0c Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Mon, 13 Jan 2025 10:08:41 +0300 Subject: [PATCH] Fixed #7071 --- packages/primevue/src/tooltip/Tooltip.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/primevue/src/tooltip/Tooltip.js b/packages/primevue/src/tooltip/Tooltip.js index a9747921a..faa3554e0 100755 --- a/packages/primevue/src/tooltip/Tooltip.js +++ b/packages/primevue/src/tooltip/Tooltip.js @@ -249,6 +249,11 @@ const Tooltip = BaseTooltip.extend('tooltip', { getTooltipElement(el) { return document.getElementById(el.$_ptooltipId); }, + getArrowElement(el) { + let tooltipElement = this.getTooltipElement(el); + + return findSingle(tooltipElement, '[data-pc-section="arrow"]'); + }, create(el) { const modifiers = el.$_ptooltipModifiers; @@ -383,7 +388,7 @@ const Tooltip = BaseTooltip.extend('tooltip', { alignRight(el) { this.preAlign(el, 'right'); let tooltipElement = this.getTooltipElement(el); - let arrowElement = findSingle(tooltipElement, '[data-pc-section="arrow"]'); + let arrowElement = this.getArrowElement(el); let hostOffset = this.getHostOffset(el); let left = hostOffset.left + getOuterWidth(el); let top = hostOffset.top + (getOuterHeight(el) - getOuterHeight(tooltipElement)) / 2; @@ -399,7 +404,7 @@ const Tooltip = BaseTooltip.extend('tooltip', { alignLeft(el) { this.preAlign(el, 'left'); let tooltipElement = this.getTooltipElement(el); - let arrowElement = findSingle(tooltipElement, '[data-pc-section="arrow"]'); + let arrowElement = this.getArrowElement(el); let hostOffset = this.getHostOffset(el); let left = hostOffset.left - getOuterWidth(tooltipElement); let top = hostOffset.top + (getOuterHeight(el) - getOuterHeight(tooltipElement)) / 2; @@ -415,7 +420,7 @@ const Tooltip = BaseTooltip.extend('tooltip', { alignTop(el) { this.preAlign(el, 'top'); let tooltipElement = this.getTooltipElement(el); - let arrowElement = findSingle(tooltipElement, '[data-pc-section="arrow"]'); + let arrowElement = this.getArrowElement(el); let tooltipWidth = getOuterWidth(tooltipElement); let elementWidth = getOuterWidth(el); let { width: viewportWidth } = getViewport(); @@ -446,7 +451,7 @@ const Tooltip = BaseTooltip.extend('tooltip', { alignBottom(el) { this.preAlign(el, 'bottom'); let tooltipElement = this.getTooltipElement(el); - let arrowElement = findSingle(tooltipElement, '[data-pc-section="arrow"]'); + let arrowElement = this.getArrowElement(el); let tooltipWidth = getOuterWidth(tooltipElement); let elementWidth = getOuterWidth(el); let { width: viewportWidth } = getViewport();