1b1a0aa39ffd5c18dbb425fca096ea335ed154fe
max
  Wed Mar 25 06:42:39 2026 -0700
superTrack hgTrackUi: auto-hide when all children hidden, grey dropdown on hide
refs #37282

Route button clicks through superT.selChanged() by triggering the
dropdown change event instead of just setting its value.  This fixes
three problems: (1) hiding all subtracks now auto-hides the superTrack
container (matching composite track behavior), (2) the superTrack
show/hide dropdown greys out when set to hide, and (3) clicking Hide
on a subtrack no longer forces the superTrack to show.

This makes the code actually simpler. I didn't know about selChanged()
when I wrote the new superTrack code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

diff --git src/hg/js/hui.js src/hg/js/hui.js
index 75bd9eb7fd9..76c8485771f 100644
--- src/hg/js/hui.js
+++ src/hg/js/hui.js
@@ -1276,30 +1276,40 @@
         if (selIx === 0) {
             $(sel).removeClass('normalText');
             $(sel).addClass('hiddenText');
         } else {
             $(sel).removeClass('hiddenText');
             $(sel).addClass('normalText');
             superT.topVis(true);
         }
         if (val === undefined || val === null) { // onchange event only
             var cb = $('input#'+sel.name+'_check');
             if (cb && cb.length === 1) {
                 cb = cb[0];
                 $(cb).prop('checked', (selIx > 0));
             }
         }
+        // Auto-hide superTrack if all children are now hidden
+        if (selIx === 0) {
+            var anyVisible = false;
+            $('#superTrackTable select.vizSelect').each(function() {
+                if (this.selectedIndex > 0)
+                    anyVisible = true;
+            });
+            if (!anyVisible)
+                superT.topVis(false);
+        }
     }
 };
 
 var mat = { // Beginings of matrix object
 
     matrix: undefined,
     dimensions: 0,
     cellInFocus: undefined,
 
     cellHover: function (cell,on)
     {
         if (on) {
             if (mat.cellInFocus)
                 mat.clearGhostHilites();  // Necessary to clear ghosts
             mat.cellInFocus = cell;