2553054d037adf52889a666cc4ca131295cd7e8c chmalee Fri Aug 22 11:42:23 2025 -0700 Make gear icon click just be the same as clicking on the grey bar itself, refs #34420 diff --git src/hg/js/utils.js src/hg/js/utils.js index 5c7d1213d94..87836fe082e 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -3850,43 +3850,43 @@ } if (typeof greyBarIcons !== 'undefined' && greyBarIcons === true) { // add a gear icon over the grey bar to bring up the context menu let tdBtn = document.getElementById("td_btn_" + id); if (tdBtn) { if (!document.getElementById("gear_btn_" + id)) { let span = document.createElement("span"); span.id = "gear_btn_" + id; span.classList.add("hgTracksGearIcon", "ui-icon", "ui-icon-gear"); span.title = "Configure track"; tdBtn.appendChild(span); tdBtn.style.position = "relative"; addMouseover(span, span.title); span.addEventListener("click", (e) => { - // create a contextmenu event that the imgTbl will pick up + // trigger a click on the of the td e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation(); - const rightClickEvent = new MouseEvent("contextmenu", { + const clickEvent = new MouseEvent("click", { bubbles: true, cancelable: true, view: window, clientX: tdBtn.getBoundingClientRect().left + 15, clientY: tdBtn.getBoundingClientRect().top, - button: 2, + button: 1, }); - tdBtn.dispatchEvent(rightClickEvent); + tdBtn.children[0].dispatchEvent(clickEvent); }); } } // add an 'x' icon in the label area to hide the track let tdSide = document.getElementById("td_side_" + id); if (tdSide) { // mouseover event fires if you stop moving the mouse while still // hovering the element and then move it again, don't make // duplicate btns in that case if (!document.getElementById("close_btn_" + id)) { let btn = document.createElement("span"); btn.id = "close_btn_" + id; btn.classList.add("hgTracksCloseIcon", "ui-icon", "ui-icon-close"); btn.title = "Hide track";