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: ion-button inherits styles from ancestor elements when in a keep-contents-mounted ion-modal #29150
Comments
Thanks for the report. Buttons take on additional styles when they are used inside of a toolbar. When When The class is not re-evaluated every time the button moves around in the DOM as that would introduce a performance overhead. Can you try moving the modal outside of the toolbar and let me know if that resolves the issue? |
Yes, both buttons are rendered normally when moving the modals outside of the toolbar Is it advised to put modals outside the ion-page like this? <template>
<ion-page>
<ion-header>
<ion-toolbar>
<ion-buttons>
<ion-button id="normal-ion-modal-trigger">Normal</ion-button>
<ion-button id="kept-ion-modal-trigger">Kept</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
</ion-page>
<ion-modal trigger="normal-ion-modal-trigger">
<ion-button>Normal</ion-button>
</ion-modal>
<ion-modal trigger="kept-ion-modal-trigger" keep-contents-mounted>
<ion-button>Kept</ion-button>
</ion-modal>
</template> |
As long as the modal is outside of the toolbar that should be enough to avoid this behavior. You can keep the modal inside of |
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. |
Prerequisites
Ionic Framework Version
v7.x
Current Behavior
ion-button inherits styles from ancestor elements when in a keep-contents-mounted ion-modal, but does not inherit when the keep-contents-mounted property set false
Expected Behavior
Same inheritance behaviour & style in both keep-contents-mounted & not keep-contents-mounted ion-modal
Steps to Reproduce
Normal button is solid but Kept button is transparent and set
in-toolbar in-buttons button-clear
class:Code Reproduction URL
https://github.com/SpaceTimee/test
Ionic Info
Ionic:
Ionic CLI : 7.2.0
Ionic Framework : @ionic/vue 7.7.4
Capacitor:
Capacitor CLI : 5.7.2
@capacitor/android : not installed
@capacitor/core : 5.7.2
@capacitor/ios : not installed
Utility:
cordova-res : not installed globally
native-run : not installed globally
System:
NodeJS : v20.7.0
npm : 10.2.4
OS : Windows 10 (Windows 11 actually)
Additional Information
No response
The text was updated successfully, but these errors were encountered: