Skip to content

bug: inline modal/popover framework integrations should automatically dismiss before unmount #23567

Closed

Description

@tho-masn

Bug Report

Ionic version:

[ ] 4.x
[ ] 5.x
[x] 6.x

Current behavior:
The closing behavior of the ion-modal vue component changed. I have a base modal which is integrated similar to this:

<BaseModal
    v-if="showModal"
    @click:close="showModal = false"
/>

The BaseModal component wraps the actual ion-modal component, setting is-open always to true. So the outer v-if decides if the modal gets rendered or not.

In v5 setting showModal to false triggered the close animation. In v6.beta-0 the modal disappears immediately.

Behavior in v5:

v5-modal.mov

Behavior in v6:

v6-modal.mov

Expected behavior:
The close animation should be triggered if the Modal gets deactivated via v-if

Steps to reproduce:
Sample code for v5: https://github.com/tho-masn/ionic-issues/tree/v5-ion-modal-close
Sample code for v6: https://github.com/tho-masn/ionic-issues/tree/v6-ion-modal-close

Activity

  1. liamdebeasi commented on Jul 6, 2021

    @liamdebeasi
    Contributor

    Thanks for the issue. With v6 we are trying to move as much of the inline modal logic inside of ion-modal itself and away from the framework-specific wrappers.

    The framework-specific wrappers automatically call dismiss in onVnodeBeforeUnmount which is something that got removed in v6, but I think we should still keep this functionality.

    For context, here is what the modal wrappers look like in v5: https://github.com/ionic-team/ionic-framework/blob/master/packages/vue/src/vue-component-lib/overlays.ts

    And here is what modal looks like in v6: https://github.com/ionic-team/ionic-framework/blob/next/packages/vue/src/components/IonModal.ts. I think we could add onVnodeBeforeUnmount here to preserve this dismiss behavior.

    edit: This behavior should probably be extended to Angular and React as well.

  2. added
    package: angular
    package: react
    package: vue
    type: bug
    v6
    on Jul 6, 2021
  3. changed the title [-]bug: ion-modal close animation does not work anymore if modal is wrapped in v-if[/-] [+]bug: inline modal/popover framework integrations should automatically dismiss before unmount[/+] on Jul 6, 2021
  4. added
    type: bug
    and removed
    type: bug
    on Jul 16, 2021
  5. tho-masn commented on Dec 9, 2021

    @tho-masn
    Author

    @liamdebeasi: I'm wondering if there is any workaround to this? I've tried dismissing the modal manually in the vnode-before-unmount hook of my BaseModal component, but that doesn't seem to work correctly.
    Would be happy for any guidance, as this is blocking us from upgrading to v6.

  6. liamdebeasi commented on Dec 9, 2021

    @liamdebeasi
    Contributor

    You might be able to integrate with Vue Enter and Leave Transitions. This is likely what we will implement internally.

  7. thetaPC commented on May 5, 2023

    @thetaPC
    Contributor

    Thank you for submitting the issue! The team has investigated this further. If an overlay is unmounted via a conditional rendering then the dismiss animation will not occur.

    If you want to have the dismiss animation, then it is recommended to call the dismiss function before unmounting.

    async dismiss() {
       await this.$refs.modal.$el.dismiss();
       this.showModal = false;
    },
  8. ionitron-bot commented on Jun 4, 2023

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  9. locked and limited conversation to collaborators on Jun 4, 2023
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

    package: angularpackage: reactpackage: vuetype: bugv6

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions