You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: popover height calculated incorrectly with popoverController + component #30320
I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v8.x
Current Behavior
When creating a popover with the popoverController and an Angular component, the height of the popover is calculated before Angular's change detection cycle is run. This means that if you are passing content into the popover, the height will be calculated incorrectly and the popover will be positioned wrong.
This mainly shows up when putting the popover in a footer as the offset is calculated using the content height.
Expected Behavior
Ionic shouldn't calculate the content height of the popover before a change detection cycle has run so that any height changes caused by component props will be reflected.
Steps to Reproduce
const popover = await this.popoverController.create({
component: PopoverContentComponent,
componentProps: { message: "some multiline content" },
event: { target: element } as unknown as Event, // an element in a footer
});
Verified that this is fixed on 9.0.7. When a component opened with PopoverController renders text from componentProps, Angular used to fill in those bindings one tick after the component was attached. With the IonicModule (lazy loaded) imports, the popover measured its content before that tick, so it positioned itself for a nearly empty box and the real content ran past the bottom of the screen. Angular now runs change detection on the component as soon as it is attached, so the popover measures the rendered content.
This was fixed in #31235, which shipped in 8.8.12. To pick up the fix, update to @ionic/angular 8.8.12 or later, or to 9.x. No code changes are needed.
Wrapping the content in ion-content, as suggested in the earlier comment, only works on some 8.x releases. On later 8.x releases before 8.8.12 the popover is still mispositioned with it, so updating is the reliable fix.
Activity
willyboy commentedon Mar 30, 2025
Note, by placing the content in popover-component.html inside of an ion-content, the issue is resolved.
thetaPC commentedon Oct 14, 2026
Thanks for the report, and sorry for the delay.
Verified that this is fixed on 9.0.7. When a component opened with
PopoverControllerrenders text fromcomponentProps, Angular used to fill in those bindings one tick after the component was attached. With theIonicModule(lazy loaded) imports, the popover measured its content before that tick, so it positioned itself for a nearly empty box and the real content ran past the bottom of the screen. Angular now runs change detection on the component as soon as it is attached, so the popover measures the rendered content.This was fixed in #31235, which shipped in 8.8.12. To pick up the fix, update to
@ionic/angular8.8.12 or later, or to 9.x. No code changes are needed.Wrapping the content in
ion-content, as suggested in the earlier comment, only works on some 8.x releases. On later 8.x releases before 8.8.12 the popover is still mispositioned with it, so updating is the reliable fix.Closing this as completed.