Skip to content

bug: dismiss callback from useIonModal is not called after first dismiss #28964

Open
@MattiaGeccheleAxa

Description

@MattiaGeccheleAxa

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

When the canDismiss callback returns false the overlay layer is dismissed and the user can interact again with the modal. If the user tries to close it again the canDismiss callback callback is no longer called.

Screenshot 2024-02-02 at 17 27 57 Screenshot 2024-02-02 at 17 23 00

The Modal is opened in this way:

present({ canDismiss: canDismiss})

Expected Behavior

If the user does not wish to close the modal, canDismiss must return false. But the user should be allowed to close the modal at a later time.

Steps to Reproduce

  1. Open an IonModal using the hook useIonModal
  2. Provide a canDismiss function which returns resolve(false) if the user doesn't want to close the modal
  3. Close the modal using the dimissfunction
  4. Refuse to close the modal and the overlay layer will disappear
  5. Call the dismiss again
  6. Nothing happens

Code Reproduction URL

No response

Ionic Info

I have an error running it linked to the macOS:
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions