Skip to content

bug: modal with swipe gesture should call onWillDismiss once dismiss is confirmed #28540

@aeharding

Description

@aeharding

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

When swiping to dismiss a modal, onWillDismiss is called after modal dismiss animation completes.

Expected Behavior

onWillDismiss should be called as soon as Ionic determines if the modal should be dismissed. For swipe to dismiss, I would expect this to happen after the user lifts their finger off the screen following the swipe to dismiss gesture, if Ionic calculates that the modal should dismiss.

Steps to Reproduce

  1. Run reproduction
  2. Swipe to dismiss
  3. Observe alert incorrectly presents after animation completes
  4. Additionally, observe tapping "close" button correctly presents alert before animation starts

Code Reproduction URL

https://stackblitz.com/edit/u8qciq-6x7ht2?file=src%2Fmain.tsx

Ionic Info

N/A - running codepen

Additional Information

Potentially related? #17600

I am tagging this as a bug because when dismissing though a non-swipe button (programmatically or through dismiss button),onWillDismiss is correctly called before the dismiss animation starts.

This is a problem for my app because I would like to dismiss the keyboard as soon as I know the modal will dismiss, not after the modal finishes animating out.

Swipe down - Incorrect behavior

Kapture.2023-11-15.at.17.42.45.mp4

Tap to dismiss - Correct behavior

Kapture.2023-11-15.at.17.43.18.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions