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

CollectionView on Android Consumes Gestures #25758

Open
david-maw opened this issue Nov 9, 2024 · 6 comments
Open

CollectionView on Android Consumes Gestures #25758

david-maw opened this issue Nov 9, 2024 · 6 comments
Labels
area-gestures Gesture types platform/android 🤖 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@david-maw
Copy link

david-maw commented Nov 9, 2024

Description

The setup is a CollectionView inside a grid. The grid has gesture recognizers defined, the CollectionView does not.

Tapping on the page triggers the tap gesture recognizer unless you tap within the CollectionView in which case the tap is ignored on Android and Windows.

Steps to Reproduce

Clone the repository, build and run the app. You should see:

Image

Tap on the page and the tap will be reported unless you tap within the CollectionView.

Link to public reproduction project repository

https://github.com/david-maw/SimpleCollectionView-missing-gestures.git

Version with bug

9.0.0-rc.2.24503.2

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Windows, Android, I was not able test on other platforms

Affected platform versions

Windows 11, Android 14

Did you find any workaround?

Sort of....

You can attach a GestureRecognizer to the CollectionView but doing so will inhibit native CollectionView scrolling on Android so you then must implement your own scrolling logic (there is an example in the test case, just commented out). If it were not for the fact that the GestureRecognizer inhibits scrolling on Android (see #10213), I'd have just assumed this was a feature.

Relevant log output

@david-maw david-maw added the t/bug Something isn't working label Nov 9, 2024
Copy link

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@jfversluis jfversluis changed the title CollectionVew on Android Consumes Gestures CollectionView on Android Consumes Gestures Nov 10, 2024
@ninachen03
Copy link

This issue has been verified using Visual Studio 17.12.0 Preview 5(9.0.0-rc.2.24503.2 & 8.0.92). Can repro this issue at android platform

@ninachen03 ninachen03 added platform/android 🤖 s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Nov 11, 2024
@mattleibow
Copy link
Member

I think this is correct behaviour. If you have a collection view and tap it, I would assume you want the taps to be handled by the collection view. Passing the tap through would break the collection view as you would no longer be able to select or scroll.

I am thinking this may also happen with a list of labels in a scroll view. The scrolling controls have to handle the touches in order to be able to detect if you want to scroll or not.

@mattleibow
Copy link
Member

@ninachen03 did you test Windows? I see the title says Android, but the description mentions both Android and Windows.

@mattleibow mattleibow added this to the Backlog milestone Nov 11, 2024
@mattleibow mattleibow added the area-gestures Gesture types label Nov 11, 2024
@david-maw
Copy link
Author

I did test Windows, but the results were strangely inconsistent, sometimes taps were passed through, sometimes not and because I have not figured out why and when I focused on Android (which is what I really cared about anyway). The windows UI is different in that scrolling is initiated by a scroll wheel on a mouse rather than a gesture on the control itself (though I don't know how it behaves on a touch screen).

I could more easily live with an "as designed" answer if it were not for #10213 which in the more general case means putting any gesture recognizer on the CollectionView disables gesture-based scrolling. This is about handling gestures the CollectionView does not use. In practice it is mostly gestures in the open space after a partially filled CollectionView, gestures on the items might well be intercepted by the items themselves.

Passing through a Tap might inhibit selection, but if the tapped item intercepts the tap anyway it'll never reach the CollectionView and might well be coded to select (and, in my case, deselect) that item when tapped. Still, I agree that "should we pass through the tap" is tricky, maybe the answer is the moral equivalent of InputTransparent but only for the tap gesture.

All that said, you can. for example, have a tap gesture recognizer on an item in a CollectionView without disabling the native scrolling on the CollectionView. You can even have a SwipeGetureRecognizer but swipe Up and Down will be passed to the CollectionView and used for scrolling, only left and right do anything.

@H-A-Hristov
Copy link

@mattleibow correct behavior?

I am having this CollectionView gesture issue, for quite some time. (Late 22)
And also this: #18569

I will not get into arguments how this should propagate and who actually is expected to "consume" the gesture. (Not that I don't want to)
And I would agree basically with any decision. As long as it is consistent.

What really disturbs me is that on Android it does "X", on IOS "Y", on Windows "Z".
How can any of this be "correct behavior".

Explain to me again, why I should be able scroll and pinch on IOS, and not on Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-gestures Gesture types platform/android 🤖 platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants