c7221bad6eda31fe88c6f9880276d8f993ff876e
chmalee
  Thu Mar 5 12:37:14 2026 -0800
Disable recent/popular species list selection in the hgConvert toDb dropdown if there are no chains available to them. Leave them in the list but unselectable, refs #36232

diff --git src/hg/js/autocompleteCat.js src/hg/js/autocompleteCat.js
index 61a4fc722ac..7ffb288288b 100644
--- src/hg/js/autocompleteCat.js
+++ src/hg/js/autocompleteCat.js
@@ -134,41 +134,47 @@
 
             var autoCompleteSource = function(request, acCallback) {
                 // This is a callback for jqueryui.autocomplete: when the user types
                 // a character, this is called with the input value as request.term and an acCallback
                 // for this to return the result to autocomplete.
                 // See http://api.jqueryui.com/autocomplete/#option-source
                 // Note: 'this' is the widget instance
 
                 // Handle recent + popular genomes for species search bars
                 if (options.showRecentGenomes && request.term.length < 2) {
                     let recent = getRecentGenomes();
                     let popular = getPopularGenomes($el);
                     if (request.term.length === 0) {
                         // On focus with empty input, show recent + popular genomes
                         let combined = recent.concat(popular);
+                        if (typeof options.onFilterDropdown === 'function') {
+                            combined = options.onFilterDropdown(combined);
+                        }
                         if (combined.length > 0) {
                             acCallback(combined);
                             return;
                         }
                     } else {
                         // On typing 1 char, filter recent + popular genomes
                         let all = recent.concat(popular);
                         let matching = all.filter(item =>
                             item.label.toLowerCase().includes(request.term.toLowerCase()) ||
                             item.genome.toLowerCase().includes(request.term.toLowerCase())
                         );
+                        if (typeof options.onFilterDropdown === 'function') {
+                            matching = options.onFilterDropdown(matching);
+                        }
                         if (matching.length > 0) {
                             acCallback(matching);
                             return;
                         }
                     }
                 }
 
                 // Handle recent searches for position input
                 if (this.element[0].id === "positionInput" && request.term.length < 2) {
                     let searchStack = window.localStorage.getItem("searchStack");
                     if (request.term.length === 0 && searchStack) {
                         let searchObj = JSON.parse(searchStack);
                         let currDb = getDb();
                         if (currDb in searchObj) {
                             // sort the results list according to the stack order: