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

Context menu item submenu appearing and disappearing in infinite loop #142

Closed
tpetruk opened this issue Jan 13, 2022 · 0 comments · Fixed by #143
Closed

Context menu item submenu appearing and disappearing in infinite loop #142

tpetruk opened this issue Jan 13, 2022 · 0 comments · Fixed by #143
Labels
bug Something isn't working

Comments

@tpetruk
Copy link

tpetruk commented Jan 13, 2022

Steps to Reproduce:

  1. Simple ContextMenu with 2 levels of menu items, e.g.:
          <ContextMenu>
            <MenuItem Header="Item 1" />
            <MenuItem Header="Item 2">
              <MenuItem Header="Item 2.1" />
              <MenuItem Header="Item 2.2" />
            </MenuItem>
            <MenuItem Header="Item 3">
              <MenuItem Header="Item 3.1" />
              <MenuItem Header="Item 3.2" />
            </MenuItem>
          </ContextMenu>
  1. Hover the mouse over a top-level item containing child items, keep it for a couple of seconds.

Actual Result:

A submenu keeps opening and closing in a loop:
https://user-images.githubusercontent.com/93399973/149335063-91430ffe-d780-4ca3-bb9f-e41ff503f202.mp4

Initial Investigation:
The problem seems to be in the MenuItems Template.
https://github.com/AvaloniaCommunity/Material.Avalonia/blob/dev/Material.Styles/MenuItem.xaml#L69
For the Popups of submenu IsLightDismissEnabled is set to true. The thing is that it doesn't need to be true because the top-level Popup has IsLightDismissEnabled=true and it is enough.
The light-dismiss layer seems to be causing a problem, not entirely sure why, but it is always false in the other MenuItem styles for Avalonia that I've seen.

tpetruk pushed a commit to tpetruk/Material.Avalonia that referenced this issue Jan 13, 2022
@SKProCH SKProCH added the bug Something isn't working label Jan 13, 2022
SKProCH added a commit that referenced this issue Jan 13, 2022
Fix context menu submenu opening and closing in infinite loop (#142)
@SKProCH SKProCH mentioned this issue Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants