ionic-team / ionic-team/ionic-framework

bug: popover height calculated incorrectly with popoverController + component

Abierto
#30,320 1 comentario 0 reacciones 0 asignados Ver en GitHub
triage
Lenguaje dominante
TypeScript
Estrellas
52.7k
Forks
13.3k
Merge medio
1 d 15 h
PR fusionados (30 d)
51

Descripción

### Prerequisites

- [x] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#creating-an-issue).
- [x] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [x] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/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
});
```

```
import { Component, Input } from '@angular/core';
import { CommonModule } from '@angular/common';

@Component({
selector: 'popover-content',
standalone: true,
imports: [CommonModule],
templateUrl: './popover-content.component.html',
styleUrl: './popover-content.component.scss',
})
export class PopoverContentComponent {
@Input() message = '';
}
```
```


{{ message }}



```

### Code Reproduction URL

https://github.com

### Ionic Info

Ionic:

Ionic CLI : 7.2.0 (\AppData\Roaming\nvm\v18.20.3\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 8.2.7 (\node_modules\@ionic\angular)
@angular-devkit/build-angular : 18.2.12 (\node_modules\@angular-devkit\build-angular)
@angular-devkit/schematics : 18.2.12 (\node_modules\@angular-devkit\schematics)
@angular/cli : 18.2.12 (\node_modules\@angular\cli)
@ionic/angular-toolkit : not installed

Capacitor:

Capacitor CLI : not installed
@capacitor/android : 6.1.0 (\node_modules\@capacitor\android)
@capacitor/core : 6.1.0 (\node_modules\@capacitor\core)
@capacitor/ios : 6.1.0 (\node_modules\@capacitor\ios)

Utility:

cordova-res : not installed globally
native-run : not installed globally

System:

NodeJS : v18.20.3 (C:\Program Files\nodejs\node.exe)
npm : 10.7.0
OS : Windows 10

### Additional Information

_No response_

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start by tracing popoverController.create with an Angular component and inspect when the component's change detection runs relative to popover height measurement. Reproduce the issue using the provided componentProps, multiline message, and footer target. Done means the popover height and position reflect the rendered component content after its inputs are applied.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.