cae42c43b9cd412f15cc7913e82a319cb9db3f15
chmalee
  Fri Oct 15 13:02:39 2021 -0700
Fix overflow of filter list in hgTrackUi pop ups, refs #28176

diff --git src/hg/js/ddcl.js src/hg/js/ddcl.js
index 885524f..c271b2c 100644
--- src/hg/js/ddcl.js
+++ src/hg/js/ddcl.js
@@ -146,32 +146,34 @@
             if (index === 0 || facetCount === 0 || facetCount === undefined) {  // Al
                 $(facetSpan).html('');
             } else {
                 $(facetSpan).html(' ('+facetCount+')');
             }
             // facetSpan and item and this did not work to get it to hide:
             if (index === 0 || (facetCount !== 0) || $(this).attr('checked')) {
                     $(item).show();
             } else {
                 $(item).hide();
                 ++hideCount;
             }
         });
 
 
-        // make dynamic height based on current window size
-        var maxDropHeight = $(window).height() - 80;
+        // make dynamic height based on current window size, but make sure we
+        // don't take into account we may already be far down the page if there
+        // are many config options on hgTrackUi or we are in a popup
+        var maxDropHeight = $(window).height() - this.getBoundingClientRect().top - 80;
         if (maxDropHeight < 49)
             maxDropHeight = 49;
 
         // each element 22 high plus one Close panel at bottom
         var dropHeight = ($(multiSelect).children().length - hideCount + 1) * itemHeight;  
 
         if (dropHeight > maxDropHeight)
             dropHeight = maxDropHeight;
         $(dropWrapper).css({
             height: dropHeight + "px",
         });
         dropWrapper.find(".ui-dropdownchecklist-dropcontainer").css({
             height: dropHeight + "px"
         });