d86e271296446bd244d4165ca60e2368a079998c
braney
  Thu Dec 8 09:25:18 2016 -0800
fix focus problem in hgTrackUi popup for custom tracks #18500

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 3a9b3c2..bc30c21 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -3559,38 +3559,37 @@
             close: function() {
                 popUp.cleanup();
             }
         });
         
         // FIXME: Why are open and close no longer working!!!
         if (popUp.trackDescriptionOnly) {
             var myWidth =  $(window).width() - 300;
             if (myWidth > 900)
                 myWidth = 900;
             $('#hgTrackUiDialog').dialog("option", "maxWidth", myWidth);
             $('#hgTrackUiDialog').dialog("option", "width", myWidth);
             $('#hgTrackUiDialog').dialog('option' , 'title' ,
                                hgTracks.trackDb[popUp.trackName].shortLabel+" Track Description");
             $('#hgTrackUiDialog').dialog('open');
-            var buttOk = $('button.ui-state-default');
-            if ($(buttOk).length === 1)
-                $(buttOk).focus();
         } else {
             $('#hgTrackUiDialog').dialog('option' , 'title' ,
                                   hgTracks.trackDb[popUp.trackName].shortLabel+" Track Settings");
             $('#hgTrackUiDialog').dialog('open');
         }
+        var buttOk = $('button.ui-state-default');
+        $(buttOk).focus();
     }
 };
 
   ///////////////////////////////
  //// imageV2  (aka imgTbl) ////
 ///////////////////////////////
 var imageV2 = {
 
     enabled:        false,  // Will be set to true unless advancedJavascriptFeatures
                             // is turned off OR if track search of config page
     imgTbl:         null,   // formerly "trackImgTbl"  The imgTbl or null if non-imageV2.
     inPlaceUpdate:  false,  // modified based on value of hgTracks.inPlaceUpdate & mapIsUpdateable
     mapIsUpdateable:true,
     lastTrack:      null,   // formerly (lastMapItem) this is used to try to keep what the
                             // last track the cursor passed.