X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c27bb5c264c5f8760baee1956dcfc6a2657e0917..0019db357afed7f52da38e9c398f3e39ce4eb162:/services/workbench2/src/components/multiselect-toolbar/ms-toolbar-overflow-menu.tsx

diff --git a/services/workbench2/src/components/multiselect-toolbar/ms-toolbar-overflow-menu.tsx b/services/workbench2/src/components/multiselect-toolbar/ms-toolbar-overflow-menu.tsx
index 09333075d6..9f8ced940d 100644
--- a/services/workbench2/src/components/multiselect-toolbar/ms-toolbar-overflow-menu.tsx
+++ b/services/workbench2/src/components/multiselect-toolbar/ms-toolbar-overflow-menu.tsx
@@ -2,13 +2,13 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import React, { useState, useMemo } from 'react';
+import React, { useState, useMemo, ReactElement, JSXElementConstructor } from 'react';
 import { DoubleRightArrows } from 'components/icon/icon';
 import classnames from 'classnames';
 import { IconButton, Menu, MenuItem, StyleRulesCallback, Tooltip, WithStyles, withStyles } from '@material-ui/core';
 import { ArvadosTheme } from 'common/custom-theme';
 
-type CssRules = 'inOverflowMenu' | 'iconButton';
+type CssRules = 'inOverflowMenu' | 'openMenuButton' | 'menu' | 'menuItem' | 'menuElement';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     inOverflowMenu: {
@@ -16,12 +16,35 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
             backgroundColor: 'transparent',
         },
     },
-    iconButton: {
+    openMenuButton: {
         right: '10px',
     },
+    menu: {
+        marginLeft: 0,
+    },
+    menuItem: {
+        '&:hover': {
+            backgroundColor: 'white',
+        },
+        marginTop: 0,
+        paddingTop: 0,
+        paddingLeft: '1rem',
+        height: '2.5rem',
+    },
+    menuElement: {
+        width: '2rem',
+    }
 });
 
-export const OverflowMenu = withStyles(styles)((props: any & WithStyles<CssRules>) => {
+export type OverflowChild = ReactElement<{ className: string; }, string | JSXElementConstructor<any>>
+
+type OverflowMenuProps = {
+    children: OverflowChild[]
+    className: string
+    visibilityMap: {}
+}
+
+export const OverflowMenu = withStyles(styles)((props: OverflowMenuProps & WithStyles<CssRules>) => {
     const { children, className, visibilityMap, classes } = props;
     const [anchorEl, setAnchorEl] = useState(null);
     const open = Boolean(anchorEl);
@@ -45,7 +68,7 @@ export const OverflowMenu = withStyles(styles)((props: any & WithStyles<CssRules
                     aria-controls='long-menu'
                     aria-haspopup='true'
                     onClick={handleClick}
-                    className={classes.iconButton}
+                    className={classes.openMenuButton}
                 >
                         <DoubleRightArrows />
                 </IconButton>
@@ -56,6 +79,8 @@ export const OverflowMenu = withStyles(styles)((props: any & WithStyles<CssRules
                 keepMounted
                 open={open}
                 onClose={handleClose}
+                disableAutoFocusItem
+                className={classes.menu}
             >
                 {React.Children.map(children, (child: any) => {
                     if (!visibilityMap[child.props['data-targetid']]) {
@@ -63,9 +88,10 @@ export const OverflowMenu = withStyles(styles)((props: any & WithStyles<CssRules
                             <MenuItem
                                 key={child}
                                 onClick={handleClose}
+                                className={classes.menuItem}
                             >
                                 {React.cloneElement(child, {
-                                    className: classnames(child.className, classes.inOverflowMenu),
+                                    className: classnames(classes.menuElement),
                                 })}
                             </MenuItem>
                         );
