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

Nested submenu loses click event sometimes #2796

Closed
mizchi opened this issue Aug 11, 2018 · 7 comments
Closed

Nested submenu loses click event sometimes #2796

mizchi opened this issue Aug 11, 2018 · 7 comments

Comments

@mizchi
Copy link
Contributor

mizchi commented Aug 11, 2018

Environment

  • Package version(s): "@blueprintjs/core": "3.2.0",

  • Browser and OS versions: Google Chrome 68 / Mac

Steps to reproduce

  1. Open submenu
  2. Click submenu

My code

    <Menu>
      <MenuItem icon="document-open" text="Open">
        {items.map((i, index) => {
          return (
            <MenuItem
              key={index}
              text={i.name}
              onClick={() => console.log('selected', i.name)}
            />
          )
        })}
      </MenuItem>
      ...
   </Menu>

Actual behavior

Emit onClick and close submenu.

Expected behavior

Sometimes it does not emit onClick and can not close menu popup.

Possible solution

I doubt lazy behavior to initialize handler, but submenu(MenuItem) does not have lazy prop. I can not find what happen yet.

@giladgray
Copy link
Contributor

this is due to #2758, which I disabled in #2776. hasn't shipped yet so set captureDismiss={false} on <Popover> for now.

@mizchi
Copy link
Contributor Author

mizchi commented Aug 25, 2018

I tried @blueprintjs/core@3.4.0 but it does not fix this in my env

@mizchi mizchi closed this as completed Aug 25, 2018
@mizchi mizchi reopened this Aug 25, 2018
@giladgray
Copy link
Contributor

@mizchi i don't have enough information to offer more guidance. your code looks fine and this works happily on the docs site.

@tex0l
Copy link

tex0l commented Aug 29, 2018

I have the same issue on Firefox 61.0.2 on MacOS 10.13.6 with blueprintjs 3.1.0 and react 16.4.2.
And it also breaks with the same browser/OS on this page https://blueprintjs.com/docs/#core/components/menu

@kuanb
Copy link

kuanb commented Jan 26, 2019

I wanted to highlight I am experiencing this, too, right now.

I have a set of options that, when clicked, fire their onClick method when in the first menu from the popover. When I move them over into a submenu, they only register the click and fire the onClick method about ~1/3 of the time.

Screen capture of this happening:
kapture 2019-01-25 at 16 26 16

The component:

<Popover
  position={Position.RIGHT}
  boundary="viewport"
  captureDismiss={false}
  content={
    <Menu>
      <MenuItem text={t`Extrusion Style`}>
        <MenuItem
          onClick={doSomething(NoExtrusion)}
          text={t`No extrusion`} />
        <MenuItem
          onClick={doSomething(Binned)}
          text={t`Binned extrusion`} />
        <MenuItem
          onClick={doSomething(Continuous)}
          text={t`Continuous extrusion`} />
      </MenuItem>
    </Menu>
  }>
  <Clickable>
    <Box fit>
      <Box>
        <i className="mdi mdi-cube mdi-18px" />
      </Box>
      <Box>
          <div>
            {t`Some text goes here`}
          </div>
        </Box>
    </Box>
  </Clickable>
</Popover>

@kuanb
Copy link

kuanb commented Jan 26, 2019

Update: I was able to resolve above issue based off of suggestion in this other issue: #3010 (comment)

@adidahiya
Copy link
Contributor

closing in favor of #3010

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

No branches or pull requests

5 participants