6ce78cec462ba1ba659db7d90cf833f4a0d1e1b9 chmalee Fri Oct 17 14:02:38 2025 -0700 When the 'suggestTrack' input is missing that the hgTracks search box uses to call to hgSuggest, don't error out, refs #36537 diff --git src/hg/js/autocomplete.js src/hg/js/autocomplete.js index 78b3ddbbbe8..bca7a215600 100644 --- src/hg/js/autocomplete.js +++ src/hg/js/autocomplete.js @@ -146,31 +146,33 @@ } }, select: function(event, ui) { lastSelected = ui.item.value; suggestBox.updateFindMatches(ui.item.internalId); addRecentSearch(db, ui.item.geneSymbol, ui.item); selectCallback(ui.item); // jQuery('body').css('cursor', 'wait'); // document.TrackHeaderForm.submit(); } }); } // I want to set focus to the suggest element, but unforunately that prevents PgUp/PgDn from // working, which is a major annoyance. + if (typeof $(this).autocompletePosInput !== 'undefined') { $('#positionInput').on("focus", function() {$(this).autocompletePosInput("search", "");}); + } $("#positionInput").on("change", function(event) { if (!lastSelected || lastSelected !== $('#positionInput').val()) { // This handles case where user typed or edited something rather than choosing from a suggest list; // in this case, we only change the position hidden; we do NOT update the displayed coordinates. var val = $('#positionInput').val(); // handles case where users zeroes out positionInput; in that case we revert to currently displayed position if (!val || val.length === 0 || val === waterMark) val = $('#positionDisplay').text(); else val = val.replace(/\u2013|\u2014/g, "-"); // replace en-dash and em-dash with hyphen $('#position').val(val); suggestBox.clearFindMatches(); } });