From 7540d77c27e1480baa450151d98f73942542803a Mon Sep 17 00:00:00 2001 From: Mohammed Musharaf Date: Tue, 5 Dec 2023 16:46:31 +0530 Subject: [PATCH] fix : show tooltip only on truncate --- packages/nc-gui/components/nc/Tooltip.vue | 6 ++++-- packages/nc-gui/components/smartsheet/header/Cell.vue | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui/components/nc/Tooltip.vue b/packages/nc-gui/components/nc/Tooltip.vue index 97b159e4a9..3c156ee78f 100644 --- a/packages/nc-gui/components/nc/Tooltip.vue +++ b/packages/nc-gui/components/nc/Tooltip.vue @@ -65,12 +65,14 @@ onKeyStroke( ) watch([isHovering, () => modifierKey.value, () => disabled.value], ([hovering, key, isDisabled]) => { - if (!hovering || isDisabled) { + const targetElement = el?.value + const isElementTruncated = targetElement?.scrollWidth > targetElement?.clientWidth + if (!hovering || isDisabled || !isElementTruncated) { showTooltip.value = false return } - // Show tooltip on mouseover if no modifier key is provided + // Show tooltip on mouseover if no modifier key is providedInvy if (hovering && !key) { showTooltip.value = true return diff --git a/packages/nc-gui/components/smartsheet/header/Cell.vue b/packages/nc-gui/components/smartsheet/header/Cell.vue index f026dff570..f79ab0b5a4 100644 --- a/packages/nc-gui/components/smartsheet/header/Cell.vue +++ b/packages/nc-gui/components/smartsheet/header/Cell.vue @@ -99,12 +99,13 @@ const onClick = (e: Event) => { }" class="name pl-1" placement="bottom" + :data-test-id="column.title" > -
+ {{ column.title }} -
+  *