6e89bb12a35c65c0607719f2aa2c7377803d09f9
max
  Fri Sep 4 14:03:07 2026 -0700
Keep the top-right Login/Share a link menu icon inside the blue bar on narrow windows.

On screens under 1100px the icon was positioned with position:fixed, which pins it
to the top of the window.  That is the top of the blue bar only on hgTracks; on
hgGateway and the home page the bar sits below the logo banner, so the icon showed
up in the white area above it.  Use position:sticky instead, which keeps the icon in
the bar on every page and still holds it at the right edge of the visible viewport
while the 1000px-wide bar is scrolled sideways.  The hardcoded background colour is
replaced by the bar's own, which is not the same on all pages.  The links now hang in
their own span so that opening the menu no longer pushes the page content down, and
the icon is left out entirely on mirrors that have no top-right links to show.

refs #38251

diff --git src/hg/js/topLinks.js src/hg/js/topLinks.js
index b842e35c9dd..d591c968295 100644
--- src/hg/js/topLinks.js
+++ src/hg/js/topLinks.js
@@ -532,30 +532,34 @@
                 showLoginDialog(login);
             });
         }
         var share = document.getElementById("shareLink");
         if (share) {
             share.addEventListener("click", function(ev) {
                 ev.preventDefault();
                 showShareDialog(share);
             });
         }
         // Narrow-screen hamburger: toggle the dropdown of top-right links (CSS shows it only on
         // narrow viewports).  Close on an outside click or after a link inside is chosen.
         var toggle = document.getElementById("trToggle");
         var container = document.getElementById("topRightLinks");
         if (toggle && container) {
+            // Nothing to show, e.g. a mirror with no login system: leave the icon out entirely
+            // rather than offer a menu that opens empty.
+            if (container.getElementsByClassName("topRightLink").length === 0)
+                toggle.style.display = "none";
             toggle.addEventListener("click", function(ev) {
                 ev.preventDefault();
                 ev.stopPropagation();
                 var open = container.classList.toggle("trOpen");
                 toggle.setAttribute("aria-expanded", open ? "true" : "false");
             });
             container.addEventListener("click", function(ev) {
                 if (ev.target.tagName === "A") {
                     container.classList.remove("trOpen");
                     toggle.setAttribute("aria-expanded", "false");
                 }
             });
             document.addEventListener("click", function() {
                 container.classList.remove("trOpen");
                 toggle.setAttribute("aria-expanded", "false");