maui
maui copied to clipboard
[Android] CollectionView selection stops working when a behavior listens for LongClick events
Description
I wrote a behavior that listens for LongClick events and raises action modes on Android.
When this behavior is attached to items in the CollectionView's item template, selection immediately stops working.
Is this expected? I'm able to subscribe to the platform View's Click event, so the underlying functionality appears to be there. I wasn't expecting interference at this level.
If not expected, I can give you a repro project.
Steps to Reproduce
- Run repro project on Android
- Note selection works as expected with CollectionView on right. Does not work with CollectionView on left.
- Note long-press behavior is enabled for the left CV, not the right CV.
Link to public reproduction project repository
https://github.com/mfeingol/repros/tree/master/CollectionViewLongPressBehaviorRepro
Version with bug
8.0.0-rc.1.9171
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
13
Did you find any workaround?
No good ones, short of using the platform View's Click event and implementing selection mode myself.
Relevant log output
No response
Hi @mfeingol. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md
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.
Repro: https://github.com/mfeingol/repros/tree/master/CollectionViewLongPressBehaviorRepro
(Also edited original post.)
Verified this on Visual Studio Enterprise 17.8.0 Preview 2.0(8.0.0-rc.1.9171). Repro on Android 13.0-API33 with below Project:
CollectionViewLongPressBehaviorRepro.zip
Side note: I see the same behavior with Buttons as well. Attach a LongPressBehavior to them and the click event simply stops working. Using the underlying Android.Views.View's Click event works, so I'm not sure why Maui breaks here.