question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Menu] rendering problems with multiple menus

See original GitHub issue

Describe the bug

My use case is a column of cards with actions that can be taken (e.g. duplicate, delete). At the top of the list, the menus seem to work fine. But when you start scrolling down the list and open the menus, we start to see some strange behaviour:

  • Sometimes the menu will flicker.
  • Sometimes you’ll scroll up and try to open the menu and it won’t appear.
  • Sometimes the options are very hard to select because the menu jumps around.

See this screen capture from the codesandbox:

CleanShot 2019-11-19 at 11 59 40

Here’s another example from my app:

CleanShot 2019-11-19 at 12 06 41

Expected Behavior

I expect the menus to work as normal when they’re in a list.

To Reproduce Use this codesandbox: https://codesandbox.io/s/chakra-js-starter-xxqzk

Suggested solution(s)

I think using portals might be a better fit for my use case because of how the positioning needs to work. I think maybe allowing Menu to accept the usePortal prop might help. I had a look at the implementation and usePortal is hard coded to false: https://github.com/chakra-ui/chakra-ui/blob/91966cef0a5b424b44b1850393e9f66de4f469d0/packages/chakra-ui/src/Menu/index.js#L316.

Desktop (please complete the following information):

  • OS: MacOS Catalina 10.15.1
  • Browser: Chrome
  • Version: 78.0.3904.97

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
aaronmcadamcommented, Oct 9, 2020

@Aeolun you’re welcome to fork my original codesandbox and update the code for v1: https://codesandbox.io/s/chakra-js-starter-xxqzk

1reaction
segunadebayocommented, Nov 21, 2019

@aaronmcadam, that might work. I’m thinking it has to do with some modifiers in popper.js, maybe enableEventListeners needs to be set to false.

Not sure but I’ll look into it. The walkaround is to use Popover directly. I’ll test this within the dev-ts and ensure this bug is fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

User error on rendering second level menu items with Layout ...
Hello, i have same problem rendering menu with two levels. The problem is foreach Element::Children with is_expanded, is_collapsed .
Read more >
How to fix problem with multiple menu item from material ui
When I try to put Menu component many times I get wrong popup list. I show my problem on codesandbox link below. I...
Read more >
Context Menus in File Explorer not rendering properly
This appears anywhere within Explorer (Explorer windows and the desktop) roughly 40% of the time, the right-click menu doesn't render ...
Read more >
The Problem With Drop-Down Menus In Website Navigation
Drop-downs can sometimes render a website unusable on an iPhone or Blackberry and can also make life difficult on iPads. Drop-down menus can...
Read more >
Fix the display of "More Options" menus from file lists - Box Pulse
Clicking the "..." (More Options) menu popup from a file list often results in a truncated menu being displayed, rendering several options ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found