Skip to content

CollectionView's Items Aren't Selected When a Parent Has a TapGestureRecognizer #26182

@brett-macisaac

Description

@brett-macisaac

Description

When a CollectionView is nested inside a parent that has a TapGestureRecognizer, the CollectionView's items cannot be selected unless the user presses the item for at least a few seconds (even then sometimes it doesn't work). The parent with the TapGestureRecognizer also doesn't have to be a direct parent for the issue to arise, I've just structured the XAML in the MPE this way for simplicity.

The expected behaviour is that the TapGestureRecognizer of the CollectionView's parent shouldn't be called and the CollectionView's items should be selected as intended. This is the behaviour that occurs on Android and is also the behaviour that's observed when a normal Button is clicked on iOS.

Steps to Reproduce

  1. Try to click one of the CollectionView's items (i.e. either 'Hello' or 'World'). You will fine that the container's TapGestureRecognizer is called, but the CollectionView's selection doesn't occur.
  2. Press down on one of the CollectionView's items for a few seconds. You might find that the selection occurs (and that the parent's TapGestureRecognizer isn't called).
  3. Click the "Hello World" button beneath the CollectionView. You should observe that its command is called without issue, which contrasts with the CollectionView's items.
  4. Remove the TapGestureRecognizer from the CollectionView's parent.
  5. Click one of the CollectionView's items again. You should notice that the selection works (without having to press down for a few seconds).

Link to public reproduction project repository

https://github.com/brett-macisaac/maui-clv-selection-bug

Version with bug

9.0.0-rc.2.24503.2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

iOS

Affected platform versions

iOS 17/18

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-collectionviewCollectionView, CarouselView, IndicatorViewp/3Work that is nice to haveplatform/ioss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions