7cc2de4244e51395682085c51e3fe27ba9f1cfc5 chmalee Fri Apr 3 16:15:20 2026 -0700 Items with a tooltip but no name now get their mouseovers to show up correctly, refs #37322 diff --git src/hg/js/utils.js src/hg/js/utils.js index 19bb33736d8..b8faf21f8da 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -3977,36 +3977,32 @@ 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) { - if (this.getAttribute('data-tooltip') !== null) { - rightClick.currentMapItem.title = this.getAttribute("data-tooltip"); - } else { 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; } @@ -4298,40 +4294,40 @@ ele.style.opacity = "0"; ele.style.visibility = "hidden"; } function titleTagToMouseover(mapEl) { /* for a given area tag, extract the title text into a div that can be positioned * like a standard tooltip mouseover next to the item */ if (mapEl.dataset.tooltip) addMouseover(mapEl, mapEl.dataset.tooltip); else addMouseover(mapEl, mapEl.title); } function convertTitleTagsToMouseovers() { /* make all the title tags in the document have mouseovers */ - document.querySelectorAll("[title]").forEach(function(a, i) { + document.querySelectorAll("[title],[data-tooltip]").forEach(function(a, i) { if (a.id !== "" && (a.id === "hotkeyHelp" || a.id.endsWith("Dialog") || a.id.endsWith("Popup"))) { // these divs are populated by ui-dialog, they should not have tooltips return; } if (a.title !== undefined && (a.title.startsWith("click & drag to scroll") || a.title.startsWith("drag select or click to zoom"))) a.title = ""; - else if (a.title !== undefined && a.title.length > 0) { - if (a.title.startsWith("Click to alter the display density")) { + else if ((a.title !== undefined && a.title.length > 0) || a.getAttribute("data-tooltip") !== null) { + if (a.title && a.title.startsWith("Click to alter the display density")) { // these tooltips have a longer delay: a.setAttribute("tooltipDelay", "delayed"); } titleTagToMouseover(a); } }); /* Mouseover should clear if you leave the document window altogether */ document.body.addEventListener("mouseleave", (ev) => { if (mouseoverContainer) { hideMouseoverText(mouseoverContainer); } }); /* Mouseover should clear on scroll */