Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PaperProps breaks Hover Menu #56

Closed
ivoiv opened this issue Apr 22, 2021 · 2 comments
Closed

PaperProps breaks Hover Menu #56

ivoiv opened this issue Apr 22, 2021 · 2 comments
Labels

Comments

@ivoiv
Copy link

ivoiv commented Apr 22, 2021

Sending PaperProps breaks the "hover transfer" for Hover Menu.
When moving the mouse from the button to the menu it instantly closes.

I guess it's because the submitted PaperProps(at least the style) override Hover Menu's own, instead of them being combined.

Modified example from this example

import * as React from 'react'
import Menu from 'material-ui-popup-state/HoverMenu'
import MenuItem from '@material-ui/core/MenuItem'
import Button from '@material-ui/core/Button'
import {
  usePopupState,
  bindHover,
  bindMenu,
} from 'material-ui-popup-state/hooks'

const MenuPopupState = () => {
  const popupState = usePopupState({ variant: 'popover', popupId: 'demoMenu' })
  return (
    <React.Fragment>
      <Button variant="contained" {...bindHover(popupState)}>
        Hover to open Menu
      </Button>
      <Menu
        {...bindMenu(popupState)}
        getContentAnchorEl={null}
        anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
        transformOrigin={{ vertical: 'top', horizontal: 'left' }}
        PaperProps={{ style: { borderRadius: 2 } }} // <--- This breaks the hover
      >
        <MenuItem onClick={popupState.close}>Cake</MenuItem>
        <MenuItem onClick={popupState.close}>Death</MenuItem>
      </Menu>
    </React.Fragment>
  )
}

export default MenuPopupState
@ivoiv ivoiv changed the title transitionDuration={0} breaks Hover Menu PaperProps breaks Hover Menu Apr 22, 2021
@jedwards1211
Copy link
Member

Okay, sorry for the delay, I made a dumb mistake where passing your own PaperProps.style would blow away the pointerEvents: 'auto' style I was injecting. The CI build should comment on this issue once it releases the fix.

@jedwards1211
Copy link
Member

🎉 This issue has been resolved in version 1.8.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants