diff --git a/src/GleapTooltipManager.js b/src/GleapTooltipManager.js index 46e4bb6..d0d1772 100644 --- a/src/GleapTooltipManager.js +++ b/src/GleapTooltipManager.js @@ -306,7 +306,10 @@ export default class GleapTooltipManager { var range = document.createRange(); range.selectNodeContents(element); const style = window.getComputedStyle(element); - elementRect.width = range.getBoundingClientRect().width + parseFloat(style.paddingLeft); + const fixedWidth = range.getBoundingClientRect().width + parseFloat(style.paddingLeft); + if (fixedWidth < elementRect.width) { + elementRect.width = fixedWidth; + } } catch (exp) { } const anchorElement = document.querySelector(`[data-gleap-tooltip-anchor="${tooltipId}"]`);