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

Android: AppShell prevents gestures on native control #6553

Closed
dotMorten opened this issue Apr 27, 2022 · 11 comments
Closed

Android: AppShell prevents gestures on native control #6553

dotMorten opened this issue Apr 27, 2022 · 11 comments
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout p/1 Work that is critical for the release, but we could probably ship without partner Issue or Request from a partner team platform/android 🤖 s/triaged Issue has been reviewed t/bug Something isn't working

Comments

@dotMorten
Copy link
Contributor

dotMorten commented Apr 27, 2022

Description

When using our native Android map control that uses motion events to detect and act on drag and pinch to navigate the control, the AppShell view intercepts these events and prevents dragging and pinching beyond the first few pixels (if appears that if you drag or pinch very slowly you can get a little further before this event gets intercepted and stops responding).
The control works fine outside an AppShell.

The native control is relying on GestureDetector, ScaleGestureDector and MotionEvents/Touch to react to user input. It returns true on these event handlers to mark them as handled when reacting to user input.

It was suggested by @PureWeen that locking the flyout behavior could address it based on, but that didn't help. ie in AppShell constructor:

        this.FlyoutBehavior = FlyoutBehavior.Locked;

When doing this though, I do notice that the touch events does go through the flyout and down into the map control (but still with the limited interaction).
Setting InputTransparent=true or IsEnabled=false on the appshell also doesn't have any effect.

The same control wrapped in Xamarin.Forms AppShell does not exhibit this behavior.

Steps to Reproduce

  1. Open the following project: MauiApp21.zip
  2. Run the project.
  3. On the presented world map, attempt to pan an zoom
  4. Notice that the map will stop responding to pan and zoom interactions after a few pixels of finger movement.
  5. In App.xaml.cs, change the app to launch MainPage instead of AppShell, and observe interactions now work fine.

Version with bug

Release Candidate 2 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

Don't use AppShell, but that's hardly a workaround.

Relevant log output

No response

Update

As noted below looks like only horizontal gestures are getting blocked. Vertical pan and zoom/pinch works (but as soon as a horizontal threshold is performed all interaction stops)

@dotMorten dotMorten added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Apr 27, 2022
@XamlTest XamlTest added s/triaged Issue has been reviewed and removed s/triaged Issue has been reviewed labels Apr 28, 2022
@jfversluis jfversluis added platform/android 🤖 area-controls-shell Shell Navigation, Routes, Tabs, Flyout and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Apr 28, 2022
@Sasikumar3595
Copy link

@jfversluis,

We are also facing the same issue after the VS update.

@beto-rodriguez
Copy link

beto-rodriguez commented Apr 30, 2022

Same issue here.

In my case, the pinch gesture fires the zoom feature in a chart, notice how it is only working when the pinch is vertical, and ignored when horizontal (3 MB gif):

maui-gesture-bug

@dotMorten
Copy link
Contributor Author

dotMorten commented Apr 30, 2022

@beto-rodriguez aaaah good call! That explains why I see a little bit of interaction and then stops. If I very carefully pan or pinch vertically I can go pretty far, but as soon as I exceed a small horizontal threshold it stops the interaction. I'm assuming our control just acts slightly different and stops reacting completely when this happens where yours doesn't.

@dotMorten
Copy link
Contributor Author

I'm curious if this is caused by this behavior in ViewPager2?
https://developer.android.com/training/animation/vp2-migration#nested-scrollables

@dotMorten
Copy link
Contributor Author

Built a Xamarin.Android .net6 app and using the ViewPager2 then putting my control inside it, and I observe the exact same behavior, so pretty confident this is caused by that

@Redth Redth added this to the 6.0.300 milestone May 3, 2022
@Redth Redth added p/0 Work that we can't release without p/1 Work that is critical for the release, but we could probably ship without and removed p/0 Work that we can't release without labels May 3, 2022
@shimingsg
Copy link
Collaborator

verified repro on android 11 with VS 17.3.0 Preview 2.0 [32506.315.main]
change the app to launch MainPage instead of AppShell, and observe interactions now work fine

@shimingsg shimingsg added the s/verified Verified / Reproducible Issue ready for Engineering Triage label May 7, 2022
@samhouts samhouts modified the milestones: 6.0.300, 6.0.300-servicing May 12, 2022
@samhouts samhouts added the partner Issue or Request from a partner team label Jul 20, 2022
@PureWeen PureWeen removed their assignment Aug 3, 2022
@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@samhouts samhouts modified the milestones: Backlog, .NET 8 Planning Jan 26, 2023
@samhouts samhouts removed the s/verified Verified / Reproducible Issue ready for Engineering Triage label Apr 5, 2023
@beto-rodriguez
Copy link

This now seems to be working properly for me on net 7

@Zhanglirong-Winnie Zhanglirong-Winnie added s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels Aug 3, 2023
@ghost
Copy link

ghost commented Aug 3, 2023

Hi @dotMorten. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@Zhanglirong-Winnie
Copy link
Collaborator

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 5.0. Not repro on android device platform with sample project.
MauiApp21.zip

@dotMorten
Copy link
Contributor Author

Confirmed

@ghost ghost removed the s/try-latest-version Please try to reproduce the potential issue on the latest public version label Aug 3, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout p/1 Work that is critical for the release, but we could probably ship without partner Issue or Request from a partner team platform/android 🤖 s/triaged Issue has been reviewed t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants