Skip to content

bug: react/vue, rendering modal within nav does not bind events #27843

Closed

Description

@zhbhun

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

Modal content does not respond to click events.

Expected Behavior

Modal content should be able to respond to click events.

Steps to Reproduce

  1. Create a new demo by react and ionic v7.
  2. Using IonNav to manage route.
  3. Adding a modal in page of IonNav.
  4. Listen click event of modal content.
  5. Try click modal content.

Code Reproduction URL

https://stackblitz.com/edit/stackblitz-starters-xh6gbc

Ionic Info

Ionic:
Ionic Framework : @ionic/react 7.1.3

System:
NodeJS : v16.19.1
npm : 8.19.3
OS : macOS

Additional Information

No response

Activity

  1. changed the title [-]bug: [/-] [+]bug: Modal in IonNav can't listen to click events.[/+] on Jul 24, 2023
  2. self-assigned this
    on Jul 25, 2023
  3. changed the title [-]bug: Modal in IonNav can't listen to click events.[/-] [+]bug: react, rendering modal from within nav does not bind click events[/+] on Jul 25, 2023
  4. removed their assignment
    on Jul 25, 2023
  5. zhbhun commented on Aug 21, 2023

    @zhbhun
    ContributorAuthor

    I found that ion-modal is using CoreDelegate to modify the insertion position of DOM elements at display time, which is causing the react event proxy mechanism to break down. Hopefully this will help speed up the fix.

    1. this.usersElement = await attachComponent(delegate, el, this.component, ['ion-page'], this.componentProps, inline);
    2. app.appendChild(BaseComponent);
  6. vu0tran commented on Nov 29, 2023

    @vu0tran

    Any updates on this one or tips for a workaround?

  7. changed the title [-]bug: react, rendering modal from within nav does not bind click events[/-] [+]bug: react, rendering modal from within nav does not bind events[/+] on Jan 17, 2024
  8. mhryshkin commented on Jan 17, 2024

    @mhryshkin

    Any updates on this one or tips for a workaround?

    I've been struggling with the same issue recently. The workaround I found to enable the usage of IonNav is as follows: (Note: I had actually re-implemented much of my project to use IonNav before I discovered this issue.)

    <Modal isOpen={true}>
        <IonNav
            root={() => (
               ... The content of your modal.
             )}
             ></IonNav>
        </Modal>
    

    So, what I'm doing is adding a nested IonNav for the modal, and it works perfectly. This has been the easiest workaround I've found.

  9. changed the title [-]bug: react, rendering modal from within nav does not bind events[/-] [+]bug: react, rendering modal within nav does not bind events[/+] on Jan 25, 2024
  10. averyrousseau commented on Feb 5, 2024

    @averyrousseau
    Contributor

    Confirming that this also reproduces in Vue, but not Angular (including standalone).

  11. changed the title [-]bug: react, rendering modal within nav does not bind events[/-] [+]bug: react/vue, rendering modal within nav does not bind events[/+] on Feb 5, 2024
  12. ShaneK commented on May 20, 2026

    @ShaneK
    Member

    Hey everyone! In React I have a PR up now that should fix this: #31159

    In Vue, this was fixed some time ago by #30227

  13. added a commit that references this issue on May 20, 2026
    fa4593d
  14. ShaneK commented on May 20, 2026

    @ShaneK
    Member

    Thank you for your patience in this issue. The fix for this has been released in 8.8.8!

  15. ionitron-bot commented on Jun 19, 2026

    @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.

  16. locked and limited conversation to collaborators on Jun 19, 2026
  17. added a commit that references this issue on Oct 3, 2026
    6f27b81
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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions