ee93b178ce4495b2d0d27d79e6831620a4e7370a
chmalee
  Thu Dec 22 10:08:15 2022 -0800
Remove leading and trailing whitespace before checking for standard range specifiers or before a chromosome name lookup, refs #30415

diff --git src/hg/js/hgGateway.js src/hg/js/hgGateway.js
index a84584e..56e7bd8 100644
--- src/hg/js/hgGateway.js
+++ src/hg/js/hgGateway.js
@@ -1498,31 +1498,31 @@
             uiState.db = db;
             clearPositionInput();
         }
     }
 
     function onClickCopyPosition() {
         // Copy the displayed position into the position input:
         var posDisplay = $('#positionDisplay').text();
         $('#positionInput').val(posDisplay).focus();
     }
 
     function goToHgTracks() {
         // Create and submit a form for hgTracks with hidden inputs for org, db and position.
         var goDirectlyToHgTracks = false;
         var position = $('#positionInput').val();
-        var searchTerm = encodeURIComponent(position);
+        var searchTerm = encodeURIComponent(position.replace(/^[\s]*/,'').replace(/[\s]*$/,''));
         var posDisplay = $('#positionDisplay').text();
         var pix = uiState.pix || calculateHgTracksWidth();
         var oldCgi = cart.cgi();
         cart.setCgi('hgSearch');
         if (! position || position === '' || position === positionWatermark ||
             position === selectedGene) {
             position = posDisplay;
             goDirectlyToHgTracks = true;
         } else {
             position = position.replace(/\u2013|\u2014/g, "-");  // replace en-dash and em-dash with hyphen
         }
         var $form;
         $form = $('<form action="hgTracks" method=GET id="mainForm">' +
                   '<input type=hidden name="hgsid" value="' + window.hgsid + '">' +
                   '<input type=hidden name="org" value="' + uiState.genome + '">' +