mui / mui/material-ui

[joy-ui][Menu] allow better trigger mechanism (click | hover)

Open
#39,877 3 comments 0 reactions 1 assignee View on GitHub

@siriwatknp is already working on this.

Since Nov 15, 2023.

on hold package: joy-ui scope: menu type: new feature
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Summary 💡
Feature: Menu trigger mechanism
  As a developer,
  I want an intuitive API to trigger visiblity of the menu
  So that I can decide how a menu should be opened

  # This is satisfied
  Scenario: Tigger is click
    When I click on the MenuButton
    Then the Menu should open
    When I click outside the Menu
    Then the Menu should close

  # This is NOT satisfied
  Scenario: Tigger is hover and user clicks outside
    When I hover on the MenuButton
    Then the Menu should open
    When I click outside the Menu
    Then the Menu should close

  # This is NOT satisfied
  Scenario: Tigger is hover and user leaves menu
    When I hover on the MenuButton
    Then the Menu should open
    When I move outside the Menu
    Then the Menu should close

Examples 🌈

This is sort of what I expect but it is a VERY complex example: https://mui.com/joy-ui/react-menu/#side-navigation-icons

Also it is extremely buggy (see video) because it will not close unless you leave the menu itself. It remains open on outside clicks

https://github.com/mui/material-ui/assets/1148334/01fae4ed-4e6d-4ee9-ba3e-056563241600

Motivation 🔦

I am trying to implement a common dropdown menu with multiple levels that can work on hover while maintaining the default click activation (as option)

I understand that this can be implemented but the amount of work needed to achieve such a behavior is extremely complex and tedious, additionally prone to bugs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.