X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1200472db41ac1494849f894a8c345d41cd830fd..5bf94d55b564bfbd052a61ab8219aa063b2a80c6:/services/workbench2/src/components/multiselect-toolbar/ms-toolbar-overflow-wrapper.tsx

diff --git a/services/workbench2/src/components/multiselect-toolbar/ms-toolbar-overflow-wrapper.tsx b/services/workbench2/src/components/multiselect-toolbar/ms-toolbar-overflow-wrapper.tsx
index 47b019e0ff..e0f32f1fa6 100644
--- a/services/workbench2/src/components/multiselect-toolbar/ms-toolbar-overflow-wrapper.tsx
+++ b/services/workbench2/src/components/multiselect-toolbar/ms-toolbar-overflow-wrapper.tsx
@@ -38,7 +38,6 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
 type WrapperProps = {
     children: OverflowChild[];
     menuLength: number;
-    isTransitioning: boolean;
 };
 
 export const IntersectionObserverWrapper = withStyles(styles)((props: WrapperProps & WithStyles<CssRules>) => {
@@ -54,6 +53,7 @@ export const IntersectionObserverWrapper = withStyles(styles)((props: WrapperPro
         const updatedEntries: Record<string, boolean> = {};
         entries.forEach((entry) => {
             const targetid = entry.target.dataset.targetid as string;
+            //if true, the element is visible
             if (entry.isIntersecting) {
                 updatedEntries[targetid] = true;
             } else {
@@ -64,12 +64,13 @@ export const IntersectionObserverWrapper = withStyles(styles)((props: WrapperPro
         setVisibilityMap((prev) => ({
             ...prev,
             ...updatedEntries,
-            [lastEntryId]: !props.isTransitioning && Object.keys(updatedEntries)[0] === lastEntryId,
+            [lastEntryId]: Object.keys(updatedEntries)[0] === lastEntryId,
         }));
     };
 
+    //ensures that the last element is always visible if the second to last is visible
     useEffect(() => {
-        if ((prevNumHidden.current === 2 || prevNumHidden.current === 0) && numHidden === 1) {
+        if ((prevNumHidden.current > 1 || prevNumHidden.current === 0) && numHidden === 1) {
             setVisibilityMap((prev) => ({
                 ...prev,
                 [lastEntryId]: true,
@@ -126,7 +127,7 @@ export const IntersectionObserverWrapper = withStyles(styles)((props: WrapperPro
                     visibilityMap={visibilityMap}
                     className={classes.overflowStyle}
                 >
-                    {children}
+                    {children.filter((child) => !child.props['data-targetid'].includes("Divider"))}
                 </OverflowMenu>
             )}
         </div>
