Skip to content

[BUG] [iOS] TouchBehaviour, Popup, and Carousel Shennanigans #1825

Closed

Description

@asi-evin

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

The Carousel loses the ability to swipe when the popup is dismissed.

Expected Behavior

You are still able to swipe between pages of the Carousel

OR

You can't dismiss the popover and swipe the carousel at the same time.

Steps To Reproduce

  1. Run Solution in the repo on an Android device
  2. Open a pop-up by pressing the "hello world" label.
  3. Swip the background, which should dismiss the popup, but it also will swipe the carousel.

Link to public reproduction project repository

https://github.com/asi-evin/PopoverCarouselBug

Environment

- .NET MAUI CommunityToolkit: 8.0.1
- OS: iOS 17
- .NET MAUI: 8.0.20

Anything else?

I notice with the button, it's less of an issue in general, BUT I have observed the same behaviour. You can also get swipe behaviour back by pressing the label while the popover is open again, and a popup will come up before dismissing itself.

Also, if anyone can find a work-a-round, it would be a huge help; this is stopping some progress.

NMEU8906.MOV

Activity

  1. bijington commented on Apr 18, 2024

    @bijington
    Contributor

    You might need to use the CanBeDismissedByTappingOutsideOfPopup property to prevent the Popup from being dismissed in this manner and add a button to the Popup that will close it.

    Or consider disabling the swipe support on the CarouselView when you are showing a Popup.

  2. asi-evin commented on Apr 18, 2024

    @asi-evin
    Author

    Hmmm, that could be tricky. Cause I do want the Dismiss behaviour, and I'm not sure how I'd make a full-screen button with an anchored view.

    Disabling the carousel is actually something I haven't tried yet, so I'll give that a go.

    Edit: Setting IsSwipeEnabled on the Open/Close events did do the trick.

    One interesting thing I've noticed though is when a popup is open, you can touch the icon to open another popup, but they will close immediately. This behaviour feels strange so probably best if it can be fixed so touches don't go through until after the popup is dismissed. This is how Android works at least.

  3. asi-evin commented on Apr 25, 2024

    @asi-evin
    Author

    Could be related to #1831.

  4. cat0363 commented on Jul 25, 2024

    @cat0363
    Contributor

    @asi-evin , You can avoid this problem by implementing as below.
    The code is an excerpt of the modified part. This is a method that does not use TouchBehavior.
    At least if you don't use TouchBehavior, this problem won't occur.

    [MainPage.xaml]

                        <Label
                            x:Name="HelloWorldLabel"
                            Grid.Row="1"
                            Text="Hello, World!"
                            Style="{StaticResource Headline}"
                            SemanticProperties.HeadingLevel="Level1">
                            
                            <Label.GestureRecognizers>
                                <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" />
                            </Label.GestureRecognizers>
    
                        </Label>
    

    [MainPage.xaml.cs]

        private async void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
        {
            if (sender is Label label)
            {
                await label.ScaleTo(0.85, 100);
                await label.ScaleTo(1.00, 100);
                this.ShowPopup(new CustomPopup { Anchor = sender as View });
    
            }
        }
    

    If you want to adjust the animation, please change the code in MainPage.xaml.cs.
    Below is the verification video.

    iPhone.15.iOS.17.0.2024-07-25.14-16-36.mp4

    Is this the behavior you expect?

    @bijington , When using TouchBehavior, a warning appears when debugging.
    It is unclear whether this warning is related to the problem.

    [0:] System.Threading.Tasks.TaskCanceledException: A task was canceled.
       at CommunityToolkit.Maui.Behaviors.GestureManager.SetScale(TouchBehavior sender, TouchState touchState, HoverState hoverState, TimeSpan duration, Easing easing, CancellationToken token)
       at CommunityToolkit.Maui.Behaviors.GestureManager.RunAnimationTask(TouchBehavior sender, TouchState touchState, HoverState hoverState, CancellationToken token, Nullable`1 durationMultiplier)
       at CommunityToolkit.Maui.Behaviors.GestureManager.ChangeStateAsync(TouchBehavior sender, Boolean animated, CancellationToken token)
       at CommunityToolkit.Maui.Behaviors.TouchBehavior.ForceUpdateState(CancellationToken token, Boolean animated)
    
  5. locked and limited conversation to collaborators on May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/viewsIssue/Discussion/PR that has to do with ViewsbugSomething isn't workingunverified

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions