maui icon indicating copy to clipboard operation
maui copied to clipboard

[Android] CollectionView selection stops working when a behavior listens for LongClick events

Open mfeingol opened this issue 2 years ago • 4 comments
trafficstars

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

  1. Run repro project on Android
  2. Note selection works as expected with CollectionView on right. Does not work with CollectionView on left.
  3. 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

mfeingol avatar Sep 22 '23 20:09 mfeingol

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.

ghost avatar Sep 25 '23 14:09 ghost

Repro: https://github.com/mfeingol/repros/tree/master/CollectionViewLongPressBehaviorRepro

(Also edited original post.)

mfeingol avatar Sep 25 '23 15:09 mfeingol

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 Select

XamlTest avatar Sep 26 '23 08:09 XamlTest

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.

mfeingol avatar Jan 27 '24 23:01 mfeingol