Fixs click away listener (#874)

This commit is contained in:
Agustin Pane 2020-05-06 09:54:20 -03:00 committed by GitHub
parent 05b3fd9b48
commit 498dca8afa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -1,6 +1,5 @@
// @flow // @flow
import { Divider } from '@material-ui/core' import { ClickAwayListener, Divider } from '@material-ui/core'
import ClickAwayListener from '@material-ui/core/ClickAwayListener'
import Menu from '@material-ui/core/Menu' import Menu from '@material-ui/core/Menu'
import MenuItem from '@material-ui/core/MenuItem' import MenuItem from '@material-ui/core/MenuItem'
import { makeStyles } from '@material-ui/core/styles' import { makeStyles } from '@material-ui/core/styles'
@ -25,6 +24,7 @@ const useStyles = makeStyles({
'&:hover': { '&:hover': {
backgroundColor: '#F0EFEE', backgroundColor: '#F0EFEE',
}, },
outline: 'none',
}, },
increasedPopperZindex: { increasedPopperZindex: {
zIndex: 2001, zIndex: 2001,
@ -43,9 +43,7 @@ const EllipsisTransactionDetails = ({ address, knownAddress }: EllipsisTransacti
const dispatch = useDispatch() const dispatch = useDispatch()
const currentSafeAddress = useSelector(safeParamAddressFromStateSelector) const currentSafeAddress = useSelector(safeParamAddressFromStateSelector)
const handleClick = (event) => { const handleClick = (event) => setAnchorEl(event.currentTarget)
setAnchorEl(event.currentTarget)
}
const closeMenuHandler = () => setAnchorEl(null) const closeMenuHandler = () => setAnchorEl(null)
@ -56,8 +54,8 @@ const EllipsisTransactionDetails = ({ address, knownAddress }: EllipsisTransacti
return ( return (
<ClickAwayListener onClickAway={closeMenuHandler}> <ClickAwayListener onClickAway={closeMenuHandler}>
<div className={classes.container} onClick={handleClick} onKeyDown={handleClick} role="menu" tabIndex={0}> <div className={classes.container} role="menu" tabIndex={0}>
<MoreHorizIcon /> <MoreHorizIcon onClick={handleClick} onKeyDown={handleClick} />
<Menu anchorEl={anchorEl} id="simple-menu" keepMounted onClose={closeMenuHandler} open={Boolean(anchorEl)}> <Menu anchorEl={anchorEl} id="simple-menu" keepMounted onClose={closeMenuHandler} open={Boolean(anchorEl)}>
<MenuItem disabled onClick={closeMenuHandler}> <MenuItem disabled onClick={closeMenuHandler}>
Send Again Send Again