Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
zhbhun opened this issue Jul 24, 2023 · 4 comments
Open
3 tasks done

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

zhbhun opened this issue Jul 24, 2023 · 4 comments
Labels
package: react @ionic/react package package: vue @ionic/vue package type: bug a confirmed bug report

Comments

@zhbhun
Copy link
Contributor

zhbhun commented Jul 24, 2023

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

@ionitron-bot ionitron-bot bot added the triage label Jul 24, 2023
@zhbhun zhbhun changed the title bug: bug: Modal in IonNav can't listen to click events. Jul 24, 2023
@liamdebeasi liamdebeasi self-assigned this Jul 25, 2023
@liamdebeasi liamdebeasi 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 Jul 25, 2023
@liamdebeasi liamdebeasi added package: react @ionic/react package type: bug a confirmed bug report labels Jul 25, 2023
@liamdebeasi liamdebeasi removed their assignment Jul 25, 2023
@ionitron-bot ionitron-bot bot removed the triage label Jul 25, 2023
@zhbhun
Copy link
Contributor Author

zhbhun commented Aug 21, 2023

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);

@vu0tran
Copy link

vu0tran commented Nov 29, 2023

Any updates on this one or tips for a workaround?

@liamdebeasi liamdebeasi 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 Jan 17, 2024
@mhryshkin
Copy link

mhryshkin commented Jan 17, 2024

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.

@zhbhun zhbhun changed the title bug: react, rendering modal from within nav does not bind events bug: react, rendering modal within nav does not bind events Jan 25, 2024
@amandaejohnston
Copy link
Contributor

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

@amandaejohnston amandaejohnston added the package: vue @ionic/vue package label Feb 5, 2024
@amandaejohnston amandaejohnston changed the title bug: react, rendering modal within nav does not bind events bug: react/vue, rendering modal within nav does not bind events Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: react @ionic/react package package: vue @ionic/vue package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

5 participants