-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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: CSS transform is not applied to popovers correctly in chrome after updating to ionic 5 #21244
Comments
Hmm maybe I am not fully understanding what the issue is. Using the following code: .popover-content {
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
} the popover should be centered horizontally and vertically. I tried the CSS on a regular div and got the same result: https://codepen.io/liamdebeasi/pen/qBOoKOw Is the screenshot linked in #21244 (comment) what you expect to see? |
I have updated the repo to use your code. Before I just had: Now I am using the code you provided. But in chrome, the transform CSS is not applied. As you can see in this screenshot from chrome the popover is not centered: In firefox, the popover is centered. |
Thanks for the follow up. I was able to reproduce the behavior you are experiencing; however, I am not sure this is an Ionic Framework bug. I tested this in an older version of Ionic 4, and I got the same result as in Ionic 5. This appears to be a browser quirk between Chrome and Firefox. Can you provide an example of this working in an Ionic 4 application with Chrome? |
https://github.com/timKraeuter/popover-transform-ionic5/tree/test |
Thanks for the follow up. I see what the difference is now. With Ionic 5 we introduced a new more performant animation engine built on Web Animations. The old engine applied inline CSS styles that you could override. In your Ionic 4 example, setting When applying the scale via Web Animations, the animation's styles take priority and cannot be overridden using I am going to close this as this is how Web Animations work and is not a bug in Ionic Framework. If you would like to force the popover to be centered on the screen, the recommended approach is to provide a custom animation to the popover via the Here are docs on how to override a component's animations: https://ionicframework.com/docs/utilities/animations#overriding-ionic-component-animations Here is a small example I made to show this working with the popover: https://codepen.io/liamdebeasi/pen/ExVEdNG Thanks! |
For future readers. My working solution (Angular/Typescript) with a custom animation is:
Thanks @liamdebeasi ! |
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. |
Bug Report
Ionic version:
[x] 5.x
Current behavior:
I am applying (global.scss)
to my Popovers to center them as described in #15036.
The CSS transform is not applied in chrome. It is applied in firefox tho.
Expected behavior:
CSS transform should apply consistently in firefox and chrome. Somehow it is not applying in chrome with ionic 5. In ionic 4 it worked.
Steps to reproduce:
Related code:
Clone the prepared GitHub repository and have a look yourself with chrome and firefox.
https://github.com/timKraeuter/popover-transform-ionic5
Other information:
I have opened this thread in the forum:
https://forum.ionicframework.com/t/popover-centering-not-working-after-ionic-4-to-5-update/189017
But I think it is a bug as it worked in ionic 4 but not in 5.
Ionic info:
The text was updated successfully, but these errors were encountered: