@@ -20,6 +20,13 @@ function collapseUncollapseOnScroll () {
2020 const topOfScreenPoint = 60
2121 const collapsePoint = 300
2222 const st = Math . floor ( window . scrollY )
23+ // Should be height of: header + search bar + whichever tree/list is visible
24+ const groupsListHeight = $ ( '#groups-card-header' ) . outerHeight ( ) +
25+ ( $ ( '#pills-tree.show' ) . outerHeight ( ) || 0 ) +
26+ ( $ ( '#pills-list.show' ) . outerHeight ( ) || 0 ) +
27+ $ ( '#search' ) . outerHeight ( )
28+ // group properties + group members list (+ priv buttons)
29+ const groupOverviewHeight = $ ( '#group-overview' ) . outerHeight ( )
2330 let collapseEl = bootstrap . Collapse . getInstance ( '#group-properties' )
2431 if ( ! collapseEl ) {
2532 collapseEl = new bootstrap . Collapse ( '#group-properties' , {
@@ -29,6 +36,10 @@ function collapseUncollapseOnScroll () {
2936
3037 if ( Math . abs ( lastScrollTop - st ) <= delta ) {
3138 return
39+ } else if ( groupsListHeight < groupOverviewHeight ) {
40+ // Skip if group list shorter than screen
41+ lastScrollTop = st
42+ return
3243 }
3344
3445 if ( st <= lastScrollTop && st <= topOfScreenPoint ) {
@@ -37,7 +48,7 @@ function collapseUncollapseOnScroll () {
3748 } else if ( st > lastScrollTop &&
3849 st > collapsePoint &&
3950 Math . abs ( lastScrollTop - st ) <= collapseDelta &&
40- $ ( '#group-overview' ) . outerHeight ( ) + buffer > $ ( window ) . height ( ) ) {
51+ groupOverviewHeight + buffer > $ ( window ) . height ( ) ) {
4152 // Have scrolled down at least a little
4253 bootstrap . Collapse . getInstance ( '#group-properties' ) . hide ( )
4354 }
0 commit comments