Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions force-app/main/default/classes/CON_ContactMerge_CTRL.cls
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ public with sharing class CON_ContactMerge_CTRL {
*/
public Map<Id, String> ariaNameMap { get; private set; }

/***********************************************************************************************
* @description Map to store Contact Duplicate Rule Ids and status
*/
public Map<Id, Boolean> duplicateRuleStatusMap { get; set; }

/***********************************************************************************************
* @description List of readonly fields
*/
Expand Down Expand Up @@ -442,6 +447,11 @@ public with sharing class CON_ContactMerge_CTRL {
showDRSButton = true;
loadMergePage = false;
showDRS = false;
duplicateRuleStatusMap = new Map<Id, Boolean>();

for (DuplicateRule duplicateRule : [SELECT Id, isActive FROM DuplicateRule WHERE SObjectType = 'Contact']) {
duplicateRuleStatusMap.put(duplicateRule.Id, duplicateRule.isActive);
}

if (!hasContactObjectDeletePermission()) {
canContinueWithMerge = false;
Expand Down
117 changes: 113 additions & 4 deletions force-app/main/default/pages/CON_ContactMerge.page
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@
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;
}
.slds-popover_tooltip {
pointer-events: auto; /* Allow pointer events for the tooltip */
user-select: text; /* Allow text selection */
cursor: text; /* Show text cursor */
}
</style>
<apex:variable var="step1class" value="{!IF(step == 1, 'slds-is-current', 'slds-is-complete')}"/>
<apex:variable
Expand Down Expand Up @@ -175,7 +186,7 @@
{!$objectType.DuplicateRecordSet.fields.LastModifiedDate.label}
</th>
<th class="slds-text-heading_label" scope="col">
{!$objectType.DuplicateRecordSet.fields.DuplicateRuleId.label}
{!SUBSTITUTE($objectType.DuplicateRecordSet.fields.DuplicateRuleId.label, ' ID', '')}
</th>
<th class="slds-text-heading_label" scope="col">
{!$Label.commonContactCount}
Expand Down Expand Up @@ -207,9 +218,41 @@
</span>
</td>
<td>
<span class="slds-truncate">
<apex:outputField value="{!drs.DuplicateRuleId}"/>
</span>
<div>
<apex:outputPanel rendered="{!NOT(duplicateRuleStatusMap[drs.DuplicateRuleId])}"
Copy link
Contributor

@andrewyu-salesforce andrewyu-salesforce Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@salesforce-suyash-more Everything looks good besides the a11y focusing issue. It seems like the tooltip is not focusable, which is an a11y violation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewyu-salesforce I have made some changes to address the focusable issue, please take a look.

styleClass="slds-m-right_xx-small"
layout="inline-block">
<div style="display: inline-flex; align-items: center; position: relative;">
<!-- Gray "i" Icon -->
<span class="slds-icon_container slds-button slds-button_icon"
style="cursor: pointer; position: relative;"
tabindex="0">
<svg class="slds-button__icon slds-icon_x-small slds-icon-text-default" aria-hidden="true">
<use href="/_slds/icons/utility-sprite/svg/symbols.svg#info"></use>
</svg>
<!-- Tooltip -->
<div class="slds-popover slds-popover_tooltip slds-nubbin_bottom"
role="tooltip"
style="position: absolute;
color: white;
padding: 8px 8px;
top: -50px;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
transition: opacity 0.2s ease;
display: none;
visibility: hidden;
opacity: 0;">
Duplicate rule is inactive
</div>
</span>
</div>
</apex:outputPanel>
<span class="slds-truncate">
<apex:outputField value="{!drs.DuplicateRuleId}"/>
</span>
</div>
</td>
<td>
<span class="slds-truncate">
Expand Down Expand Up @@ -603,5 +646,71 @@
}
}
}
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 () {
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";
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);
});
// 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();
});
}
});
});
</script>
</apex:page>
Loading