From 123f554baba055f15540b3b64bd977999fa2be7c Mon Sep 17 00:00:00 2001 From: Suyash More Date: Wed, 26 Feb 2025 17:33:29 +0530 Subject: [PATCH 1/4] show tooltip for inactive duplicate contact rules on contact merge page --- .../default/classes/CON_ContactMerge_CTRL.cls | 10 +++ .../main/default/pages/CON_ContactMerge.page | 68 +++++++++++++++++-- 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/force-app/main/default/classes/CON_ContactMerge_CTRL.cls b/force-app/main/default/classes/CON_ContactMerge_CTRL.cls index a1198f982d6..a50fde50472 100644 --- a/force-app/main/default/classes/CON_ContactMerge_CTRL.cls +++ b/force-app/main/default/classes/CON_ContactMerge_CTRL.cls @@ -264,6 +264,11 @@ public with sharing class CON_ContactMerge_CTRL { */ public Map ariaNameMap { get; private set; } + /*********************************************************************************************** + * @description Map to store Contact Duplicate Rule Ids and status + */ + public Map duplicateRuleStatusMap { get; set; } + /*********************************************************************************************** * @description List of readonly fields */ @@ -442,6 +447,11 @@ public with sharing class CON_ContactMerge_CTRL { showDRSButton = true; loadMergePage = false; showDRS = false; + duplicateRuleStatusMap = new Map(); + + for (DuplicateRule duplicateRule : [SELECT Id, isActive FROM DuplicateRule WHERE SObjectType = 'Contact']) { + duplicateRuleStatusMap.put(duplicateRule.Id, duplicateRule.isActive); + } if (!hasContactObjectDeletePermission()) { canContinueWithMerge = false; diff --git a/force-app/main/default/pages/CON_ContactMerge.page b/force-app/main/default/pages/CON_ContactMerge.page index 4f42b6c60db..612e4a6d0de 100644 --- a/force-app/main/default/pages/CON_ContactMerge.page +++ b/force-app/main/default/pages/CON_ContactMerge.page @@ -73,6 +73,12 @@ causing unwanted spaces to appear in output. this fixes that */ display: inline-flex; } + /* Tooltip hover effect */ + .slds-icon_container:hover .slds-popover_tooltip { + display: block !important; + visibility: visible !important; + opacity: 1 !important; + } - {!$objectType.DuplicateRecordSet.fields.DuplicateRuleId.label} + {!SUBSTITUTE($objectType.DuplicateRecordSet.fields.DuplicateRuleId.label, ' ID', '')} {!$Label.commonContactCount} @@ -207,9 +213,40 @@ - - - +
+ +
+ + + + + + +
+
+ + + +
@@ -603,5 +640,28 @@ } } } + document.addEventListener("DOMContentLoaded", function () { + const infoIcons = document.querySelectorAll(".slds-icon_container"); + + infoIcons.forEach(icon => { + const tooltip = icon.querySelector(".slds-popover_tooltip"); + + if (tooltip) { + icon.addEventListener("mouseenter", function () { + tooltip.style.display = "block"; + tooltip.style.visibility = "visible"; + tooltip.style.opacity = "1"; + }); + + icon.addEventListener("mouseleave", function () { + tooltip.style.opacity = "0"; + tooltip.style.visibility = "hidden"; + setTimeout(() => { + tooltip.style.display = "none"; + }, 200); + }); + } + }); + }); From 4bf00f8efe655a9f48dd6280585105e7230313f9 Mon Sep 17 00:00:00 2001 From: Suyash More Date: Mon, 24 Mar 2025 15:11:38 +0530 Subject: [PATCH 2/4] changes to make tooltip focusable --- .../main/default/pages/CON_ContactMerge.page | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/force-app/main/default/pages/CON_ContactMerge.page b/force-app/main/default/pages/CON_ContactMerge.page index 612e4a6d0de..860b604c759 100644 --- a/force-app/main/default/pages/CON_ContactMerge.page +++ b/force-app/main/default/pages/CON_ContactMerge.page @@ -219,8 +219,9 @@ layout="inline-block">
- +
-
+ @@ -660,6 +661,20 @@ tooltip.style.display = "none"; }, 200); }); + // Keyboard focus event (focus and blur) + icon.addEventListener("focus", function () { + tooltip.style.display = "block"; + tooltip.style.visibility = "visible"; + tooltip.style.opacity = "1"; + }); + + icon.addEventListener("blur", function () { + tooltip.style.opacity = "0"; + tooltip.style.visibility = "hidden"; + setTimeout(() => { + tooltip.style.display = "none"; + }, 200); + }); } }); }); From 8b3bf939179f76a30fa84ac2696b5534c35b5a09 Mon Sep 17 00:00:00 2001 From: Suyash More Date: Thu, 27 Mar 2025 12:06:20 +0530 Subject: [PATCH 3/4] change in tooltip related to focusable issue --- force-app/main/default/pages/CON_ContactMerge.page | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/force-app/main/default/pages/CON_ContactMerge.page b/force-app/main/default/pages/CON_ContactMerge.page index 860b604c759..0b3b7b8740b 100644 --- a/force-app/main/default/pages/CON_ContactMerge.page +++ b/force-app/main/default/pages/CON_ContactMerge.page @@ -219,7 +219,7 @@ layout="inline-block">
-
- +
From 8b6e4e801039d3a36510daf846ce5cc0c2ac5e0e Mon Sep 17 00:00:00 2001 From: Suyash More Date: Thu, 27 Mar 2025 19:59:28 +0530 Subject: [PATCH 4/4] changes related to focus and hover the tooltip --- .../main/default/pages/CON_ContactMerge.page | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/force-app/main/default/pages/CON_ContactMerge.page b/force-app/main/default/pages/CON_ContactMerge.page index 0b3b7b8740b..740ef0292be 100644 --- a/force-app/main/default/pages/CON_ContactMerge.page +++ b/force-app/main/default/pages/CON_ContactMerge.page @@ -79,6 +79,11 @@ visibility: visible !important; opacity: 1 !important; } + .slds-popover_tooltip { + pointer-events: auto; /* Allow pointer events for the tooltip */ + user-select: text; /* Allow text selection */ + cursor: text; /* Show text cursor */ + } - Duplicate rule is inactive. + Duplicate rule is inactive @@ -655,12 +660,31 @@ }); icon.addEventListener("mouseleave", function () { + setTimeout(() => { + // Hide the tooltip only if the mouse has left both the icon and the tooltip + if (!tooltip.matches(":hover")) { + tooltip.style.opacity = "0"; + tooltip.style.visibility = "hidden"; + tooltip.style.display = "none"; + } + }, 200); + }); + + tooltip.addEventListener("mouseenter", function () { + // Keep the tooltip visible when hovering over the tooltip itself + tooltip.style.opacity = "1"; + tooltip.style.visibility = "visible"; + tooltip.style.display = "block"; + }); + + tooltip.addEventListener("mouseleave", function () { tooltip.style.opacity = "0"; tooltip.style.visibility = "hidden"; setTimeout(() => { tooltip.style.display = "none"; }, 200); }); + // Keyboard focus event (focus and blur) icon.addEventListener("focus", function () { tooltip.style.display = "block"; @@ -675,6 +699,16 @@ tooltip.style.display = "none"; }, 200); }); + // Close tooltip and remove focus when clicking on tooltip text + tooltip.addEventListener("click", function (e) { + tooltip.style.opacity = "0"; + tooltip.style.visibility = "hidden"; + setTimeout(() => { + tooltip.style.display = "none"; + }, 200); + // Remove focus from the icon + icon.blur(); + }); } }); });