MudMenu: Fix nested menu to support multiple levels. (#7376)#9537
MudMenu: Fix nested menu to support multiple levels. (#7376)#9537henon merged 9 commits intoMudBlazor:devfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #9537 +/- ##
==========================================
+ Coverage 89.82% 90.57% +0.74%
==========================================
Files 412 406 -6
Lines 11878 12749 +871
Branches 2364 2473 +109
==========================================
+ Hits 10670 11547 +877
+ Misses 681 641 -40
- Partials 527 561 +34 ☔ View full report in Codecov by Sentry. |
|
@danielchalmers duplicate of PR #9513? |
I don't see that this page was used anywhere on the bUnit side, meaning it's not doing anything. |
61de7f2 to
306eb69
Compare
306eb69 to
004aeb9
Compare
I think this PR is a different fix. Before I started this fix, I checked this PR, and it doesn't seem to address the nested menu issue.
Updated tests. |
|
Hi, the nested menus are staying open video4.mp4 |
|
Branch has conflicts after merging the other PR |
3c8b1e9 to
4598e04
Compare
Updated |
|
@danielchalmers @henon what about var menu = this;
do
{
menu._isPointerOver = false;
menu = menu.ParentMenu;
} while (menu?.ActivationEvent == MouseEvent.MouseOver);
// If this menu is temporary and activated by MouseOver, handle delayed closure.
if (_isTemporary && ActivationEvent == MouseEvent.MouseOver)
{
// Allow a brief delay to check if the pointer re-enters the menu.
await Task.Delay(100);
// Close the menu if the pointer hasn't re-entered and the menu is still temporary.
menu = this;
do
{
if (!menu._isPointerOver && menu._isTemporary)
{
await menu.CloseMenuAsync();
}
menu = menu.ParentMenu;
} while (menu?.ActivationEvent == MouseEvent.MouseOver);
}Anyway, looks good to me. |
There was a problem hiding this comment.
Shouldn't clicking an item close the whole tree?
video4.mp4
Could update the Nested Menu example so it's MouseOver instead of a weird hybrid
https://github.com/user-attachments/assets/503afeeb-3b94-40e5-bffd-fa2d2911fc58
92bd9d7 to
2f37170
Compare
In general you choose |
|
Lets merge this? We don't have a better design on how to fix this anyway |
|
Thanks @charles7668 |


Description
When nesting menus more than one level deep with mouse over, the parent menu cannot stay displayed when the mouse moves to the nested menu.
close #7376
How Has This Been Tested?
I add a test page in MudBlazor.UnitTests.Viewer
Type of Changes
before:

after:

Checklist
dev).