05bbbe65e099bbf8e717ce9da12c608b2849bd7b
chmalee
  Wed Dec 6 14:38:46 2023 -0800
Make input boxes in hgTracks dialogs submit on pressing the enter key, refs #32684

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 7c2ef47..3fd8ef0 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -2216,30 +2216,37 @@
         var a = reg.exec(response);
         if (a && a[1]) {
             if ( ! window.open(a[1]) ) {
                 rightClick.windowOpenFailedMsg();
             }
             return;
         }
         warn("Couldn't parse out img src");
     },
 
     myPrompt: function (msg, callback)
     {   // replacement for prompt; avoids misleading/confusing security warnings which are caused
         // by prompt in IE 7+.   Callback is called if user presses "OK".
         $("body").append("<div id = 'myPrompt'><div id='dialog' title='Basic dialog'><form>" +
                             msg + "<input id='myPromptText' value=''></form>");
+        $('#myPromptText').bind('keypress', function(e) {
+            if (e.which === 13) {  // listens for return key
+                e.preventDefault();   // prevents return from also submitting whole form
+                $("#myPrompt").dialog("close");
+                callback($("#myPromptText").val());
+            }
+        });
         $("#myPrompt").dialog({
                                 modal: true,
                                 closeOnEscape: true,
                                 buttons: { "OK": function() {
                                                     var myPromptText = $("#myPromptText").val();
                                                     $(this).dialog("close");
                                                     callback(myPromptText);
                                                 }
                                         }
                             });
     },
 
     hit: function (menuItemClicked, menuObject, cmd, args)
     {
         setTimeout( function() {