MudOverlay: Refactor, Deprecate OnClick in favor of new OnClosed, Fix MudMenu interactions#9458
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #9458 +/- ##
==========================================
+ Coverage 89.82% 90.54% +0.71%
==========================================
Files 412 406 -6
Lines 11878 12705 +827
Branches 2364 2462 +98
==========================================
+ Hits 10670 11504 +834
+ Misses 681 641 -40
- Partials 527 560 +33 ☔ View full report in Codecov by Sentry. |
Handlers only fire when the parent modifies the destination parameter. MudBlazor/src/MudBlazor/Components/Overlay/MudOverlay.razor.cs Lines 148 to 151 in c2ab561 But I forgot. It was added for backward compatibility since I was making it for v6, and in the original code, it was doing this: MudBlazor/src/MudBlazor/Components/Overlay/MudOverlay.razor.cs Lines 54 to 64 in cada65f In good code, the I don't think your code is correct. It should be: if (AutoClose)
{
await _visibleState.SetValueAsync(false);
await OnClosed.InvokeAsync();
}private async Task OnVisibleParameterChangedAsync(ParameterChangedEventArgs<bool> args)
{
if (!args.Value)
{
await OnClosed.InvokeAsync(); // I'm not sure we should call OnClosed when Visible was modified by the parent, but it really depends on what you are trying to achieve.
}
}Something along those lines |
|
@ScarletKuro I made changes like that a bit ago, could you check again? |
OnClick in favor of new OnClosed, Fix MudMenu interactions
|
A functionality I can see that will be required in the future is the possibility to prevent closing in some cases due to application specific logic. This could be accomplished by a separate |
|
Awesome! Great PR @danielchalmers |
you mean like with WPF that it has property |
|
Yes, that is what I mean. |
Sounds good to me, tho it will be breaking if we add it later, because the signature: needs to be changed to something like |
|
No, you would add a separate event |
Description
Changes:
OnClickcallback #8989Appearancecategory for background colorsOnClickeventOnClosedevent to pair withAutoClosewhich can support non-click methods in the future like escape keypreventDefaultfrom mud menu's popoverOther:
How Has This Been Tested?
visually
Type of Changes
Menu inside SwipeArea - Fixes #9288
video1.mp4
Menu will close correctly and items can be clicked inside Drop Zone - Fixes #7047
video3.mp4
Menu will not be affected by snackbar - Fixes #9413
video3.mp4
Doesn't regress to menu items triggering things behind - #8790
video2.mp4
Fixes #9479
video3.mp4
Checklist
dev).