9c33941888801ec354d634a5181cb7374f43b303
kate
  Wed Feb 24 13:08:31 2016 -0800
Close UI dialog popup if track set to hidden. refs #16788.  Note #15

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 6a746cd..9ed6356 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -3469,30 +3469,34 @@
         var popWidth     = 640;
         if (popWidth > popMaxWidth)
             popWidth = popMaxWidth;
 
         // Create dialog buttons for UI popup
         var uiDialogButtons = {};
         if (popUp.trackDescriptionOnly) {
             uiDialogButtons.OK = function() {
                 $(this).dialog("close");
             };
         } else {
             uiDialogButtons.Apply = function() {
                  popUp.uiDialogOk($('#pop'), popUp.trackName);
                  // thanks to JAT for this cleverness to keep button functioning
                  popUp.saveAllVars = getAllVars( $('#hgTrackUiDialog'), popUp.trackName);
+                 if (popUp.saveAllVars[popUp.trackName+"_sel"] === 0) {       // hide
+                    // NOTE: once hidden, can't be unhidden by popup, so shut it down
+                    $(this).dialog("close");
+                }
             };
             uiDialogButtons.OK = function() {
                 popUp.uiDialogOk($('#pop'), popUp.trackName);
                 $(this).dialog("close");
             };
         }
 
         $('#hgTrackUiDialog').dialog({
             ajaxOptions: {
                 // This doesn't work
                 cache: true
             },
             resizable: true,               // Let description scroll vertically
             height: (popUp.trackDescriptionOnly ? popMaxHeight : 'auto'),
             width: popWidth,