Skip to content

bug: using a fragment with IonCard and IonModal results in error after upgrading to ionic 6  #24887

Description

@ldikmans

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

A Fragment with an IonCard and an IonModal. The modal contains a button that will close the modal AND hide the card.
Click on the Button
Observed behavior: white screen.

Error in console:
react-dom.development.js:10301 Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

Expected Behavior

Expected behavior:
modal closes and card is hidden.

It works when not using a fragment, but moving the modal to the container the card is defined in. However we want to reuse this card in several places in our app.
In previous versions this setup worked as expected. (Ionic 5)

Steps to Reproduce

Create a fragment with an IonCard and an IonModal.
Add a button on the modal that will close the modal and hides the card.
add the fragment to a container.

Run the code with developer console open

click on the card to open the modal
click on the button to close the modal and hide the card.

Code Reproduction URL

https://github.com/ldikmans/FragmentBug

Ionic Info

Ionic:

Ionic CLI : 6.18.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 6.0.10

Capacitor:

Capacitor CLI : 3.4.3
@capacitor/android : 3.4.3
@capacitor/core : 3.4.3
@capacitor/ios : 3.4.3

Utility:

cordova-res : 0.15.4
native-run : 1.5.0

System:

NodeJS : v16.13.1 (/usr/local/Cellar/node@16/16.13.1/libexec/node)
npm : 8.1.2
OS : macOS Monterey

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