3ad75c6b034903a322a9680b0cb544be1c840b08
chmalee
  Mon Nov 27 11:31:10 2023 -0800
Fix missing zoom to exon right click menu option after mouseover changes, refs #31365

diff --git src/hg/js/utils.js src/hg/js/utils.js
index 654cf65..c9894d3 100644
--- src/hg/js/utils.js
+++ src/hg/js/utils.js
@@ -3686,30 +3686,35 @@
         if (!id || id.length === 0) {
             id = '';
             var tr = $( this ).parents('tr.imgOrd');
             if ( $(tr).length === 1 ) {
                 var a = /tr_(.*)/.exec($(tr).attr('id'));  // voodoo
                 if (a && a[1]) {
                     id = a[1];
                 }
             }
         }
         if (id.length > 0) {
             rightClick.currentMapItem = rightClick.makeMapItem(id);
             if (rightClick.currentMapItem) {
                 rightClick.currentMapItem.href = this.href;
                 rightClick.currentMapItem.title = this.title;
+                // if the custom mouseover code has removed this title, check the attr
+                // for the original title
+                if (this.title.length === 0) {
+                    rightClick.currentMapItem.title = this.getAttribute("originalTitle");
+                }
 
                 // Handle linked features with separate clickmaps for each exon/intron
                 if ((this.title.indexOf('Exon ') === 0) || (this.title.indexOf('Intron ') === 0)) {
                     // if the title is Exon ... or Intron ...
                     // then search for the sibling with the same href
                     // that has the real title item label
                     var elem = this.parentNode.firstChild;
                     while (elem) {
                         if ((elem.href === this.href)
                             && !((elem.title.indexOf('Exon ') === 0) || (elem.title.indexOf('Intron ') === 0))) {
                             rightClick.currentMapItem.title = elem.title;
                             break;
                         }
                         elem = elem.nextSibling;
                     }
@@ -4075,30 +4080,31 @@
         newEl.style = "max-width: 400px"; // max width of the mouseover text
         newEl.innerHTML = text;
     } else {
         text = ele2.innerHTML;
         // if newEl was already created (as in on the server side), then
         // it may have had it's visibility hidden by default for page load purposes
         newEl.style.display = "inline-block";
     }
     if (ele1) {
         newDiv = document.createElement("div");
         newDiv.className = "tooltip";
         newDiv.style.position = "fixed";
         newDiv.style.display = "inline-block";
         if (ele1.title) {
             newDiv.id = replaceReserved(ele1.title);
+            ele1.setAttribute("originalTitle", ele1.title);
             ele1.title = "";
         } else {
             newDiv.id = replaceReserved(text);
         }
         if (ele1.coords) {
             newDiv.id += "_" + ele1.coords.replaceAll(",","_");
         }
         ele1.setAttribute("mouseoverid", newDiv.id);
         newDiv.append(newEl);
         ele1.parentNode.append(newDiv);
         ele1.addEventListener("mouseover", showMouseover);
     }
 }
 
 function titleTagToMouseover(mapEl) {