[Menu] Clicking outside a menu blocks click from bubbling up
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Current Behavior
There a fundamental issue with the menu dismissal. When presented with multiple buttons or select fields that show a menu, it take 2 clicks to dismiss the existing menu and show the next one.

Steps to Reproduce
In the demo below, try opening the first menu by clicking on the first button, then the second menu by clicking on the second button. Notice that an extra click is needed to dismiss the first menu then another one to show the second menu.
https://codesandbox.io/s/9lp94v86zo
Expected Behavior
Good UX guidelines recommend to reduce the number of clicks needed to perform an action. As opposed to modals and dialogs, menus are not expected to hijack the click away events.
The issue is that the background click to dismiss a menu, has a e.preventDefault() which prevents it from bubbling up to the other element.
In other frameworks, you can click on an other element, and it will have double effect: close up the first menu, and show the new one in one click action. For reference:
Bootstrap
http://getbootstrap.com/2.3.2/components.html#buttonDropdowns

Semantic-UI

Sencha ExtJS
http://examples.sencha.com/extjs/6.5.3/examples/kitchensink/?modern#buttons-split

UIKit
https://getuikit.com/v2/docs/button.html
Your Environment
| Tech | Version |
|---|---|
| Material-UI | v1.0.0-beta.44 |
| React | 16 |
| browser | Chrome 65 |
| etc |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox reproduction and trace the menu dismissal behavior, especially the background click handling and the reported preventDefault call. Done means clicking another button closes the existing menu and opens the next menu in a single click, with regression coverage for that interaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100