-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Menu: Improve touch support & Merge OnTouch,OnAction into OnClick #8492
Conversation
Breaking change for v7. - Remove OnTouch and OnAction in favor of OnClick like all other controls - Fix touch events falling through - Add Activate override for TouchEventArgs - Replace one use of async void - Properly handle the context menu as a right click on touch so it doesn't trigger the default action - Remove obsolete members - Closes MudBlazor#8331 - Resolves MudBlazor#4527 - Resolves MudBlazor#4549 - Resolves MudBlazor#5170 - Resolves MudBlazor#5768 - Resolves MudBlazor#7784
Took care of a few issues with the menu while simplifying the handlers to match the rest of the components. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #8492 +/- ##
==========================================
+ Coverage 89.01% 89.34% +0.33%
==========================================
Files 411 410 -1
Lines 12175 11892 -283
Branches 2431 2355 -76
==========================================
- Hits 10837 10625 -212
+ Misses 803 748 -55
+ Partials 535 519 -16 ☔ View full report in Codecov by Sentry. |
Will this problem not come back since we removed semaphore? #7651 |
@@ -6,11 +6,12 @@ | |||
<div @attributes="UserAttributes" Class="@Classname" Style="@Style" | |||
@onmouseenter="@MouseEnter" | |||
@onmouseleave="@MouseLeave" | |||
@oncontextmenu="@(ActivationEvent==MouseEvent.RightClick ? ToggleMenu : null)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we missing spaces before and after ==
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a straight copy paste. I didn't want to do clean up and pollute the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you tell me some components I could do them in bulk separately?
Isn't that only relevant due to the OnClick/OnTouch split? |
I'm actually not sure, as I understand the problem was when you click multiple times? Maybe @dennisrahmen knows wmore |
@ScarletKuro the Problem was with If I remember correctly So that you don't have to add both But that at least for me never worked on Blazor WASM. I am still adding both to my menus. |
Like this? video2.mp4 |
@dennisrahmen I think we can make OnClick functionally the same as OnAction and thus remove OnTouch and OnAction Maybe you could try this PR out if you get some free time because it seems to work well for me |
I found the original discussion #6954 |
Oh I think that's exactly the right approach I couldn't personally find any problems but always happy to test new scenarios |
@danielchalmers I will try it out this evening when I get home in my WASM App. I can also try in MAUI for Android. |
@danielchalmers If this all works would you mind looking at the coverage. We probably need an additional couple of tests in this area |
@dennisrahmen Thank you, that would be amazing
@mikes-gh Sure, what kind of tests were you thinking? |
Use codecov to view the untested lines. Some of them may not be your changes but it would be good to get the patch coverage up |
should be looking good @mikes-gh |
Thanks @danielchalmers I know it seems pedantic but there's a reason BL0005 exists. Component parameters should pass through all the normal Component lifecycles for a true test. |
@mikes-gh I don't think it's pedantic. I was just lazy and copy pasted from another test. Thanks for pointing it out 👌 |
It seems we still have a coverage deficiency though in line 293 ToggleMenu? |
Was the other method even covered? It's just a new overload and is covered by MenuTests.ToggleEventArgs() kind of. How do you test IActivator? I couldn't see it in another tests but I probably just missed it. |
Depends on what you want to do. |
@ScarletKuro just to satisfy code coverage |
We should probably wait for @dennisrahmen #8492 (comment) before merging. |
@mikes-gh @danielchalmers for reference this was the problem I had when using 'OnAction', the first two menu items have 'OnClick' and 'OnTouch' the last one has just 'OnAction'. current.mp4I wanted to try it in the app you see above as it also has a MAUI version, but with the other breaking changes I would need more time to get it running. pullrequest.mp4Now oddly enough, using the current MudBlazor Nuget on the app I created for the pull request the menu item does not work at all weather in desktop or mobile. |
I could get my app updated by mid next week and test it again, If you guys are willing to wait. |
@dennisrahmen Thanks, this is all really helpful. Can you post the code for your second example? |
@danielchalmers you can even see it in a tryMud: That's the code I used, just removed the touch and action options since your version does not have them anymore. |
It could get merged before then to avoid conflicts, but development is so heavy right now that having you test it afterwards is still extremely helpful because there won't be a new release by then anyway |
Thanks, I believe that's #5768 and should be fixed by this PR 🤞 |
What's the status? |
@henon the issue I had with the current implementation should be fixed by this pr since another user reported a similar issue and that was already addressed by @danielchalmers So as I understand @danielchalmers this pr is ready but I will still report my findings after I updated my app to the newest version in the v7. |
Thanks! |
@danielchalmers I finally updated my app to the preview-3 of v7 and could now test the behavior. Would think it has something to do with the recognition of the mobile touch in general, as you see in the video in mobile view the sub menu does not even open, I just go straight to the links in the submenus. MS Edge on the dev site and my app has the same issue as described before, the OnClick is not fired: Menus.-.MudBlazor.-.Personlich.Microsoft.Edge.2024-05-15.02-14-03.mp4 |
Here is my app, working in desktop view but not doing anything when in mobile: iTS.Dashboard.und.3.weitere.Seiten.-.Personlich.Microsoft.Edge.2024-05-15.02-26-54.mp4This is the menu code in my
|
@dennisrahmen I believe that's a missing PreventDefault or StopPropagation in the MudListItems that make up the MudMenu content. Could you transfer what you posed to a new issue so I can reference it? Basically "touches pass through menu item" I guess |
Thank you for fixing this. I was also affected by this issue. |
Description
Changes for v7:
Impact:
Everything should work the same or better.
If there's any regressions in behavior they'll be fixed.
Migration Guide - MudMenu
OnTouch
andOnAction
have been removed to simplify the API.OnClick
handles all use cases for both mouse and touch.How Has This Been Tested?
unit
Types of changes
Touch events don't fall through.
Before:
Video3.mp4
After:
Video2.mp4
Checklist:
dev
).