- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.4k
 
          feat(app): move ion-app init logic to initialize function
          #29930
        
          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
Conversation
| 
           The latest updates on your projects. Learn more about Vercel for Git ↗︎ 
  | 
    
| * | ||
| * @default 'ion-app' | ||
| */ | ||
| appRootSelector?: string; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For context, we needed to add this option because without ion-app, our overlay utils would default to injecting overlay element into the body of the DOM. However, this could cause problems in Frameworks like React where the actual React application was initialized inside a container in the DOM like div id="root", so if the overlay were outside that container, things like event listeners would not work.
With this option, devs can specify where the overlay should get injected using any valid CSS selector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested on the test app and on every React starter. I saw no issues in the test app when using the iOS and Android simulators. Passed all the tests. No issues on the starters except the list starter.
For starters, I replaced IonApp with div and IonPage with <div className='ion-page'>. As mentioned, the list starter was the only one that had issues. When I replaced IonPage with the class on the Home.tsx, it wouldn't render the list. Let me know if there's something that I'm missing.
| 
           @thetaPC Ah yes, this is another Ionic Router specific problem. The React package has a custom implementation for   | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in a browser and on iOS and Android devices. Looks good. 👍
Issue number: resolves internal
What is the current behavior?
Some app functionality (like focus management, keyboard utils, and shimming) are tied to the
ion-appwhich requires all Ionic applications to have a rootion-appelement.What is the new behavior?
ion-appspecific init functionality is moved to the globalinitializefunctionDoes this introduce a breaking change?
Although it is not expected that this introduces a breaking change, these changes were introduced on the
nextbranch as a precaution.Other information
NOTE: This is NOT a recommended pattern for Ionic applications and was created for a specific internal use case