ionic-team / ionic-team/ionic-framework

bug: additional toolbars get unnecessary padding if placed in wrapper element

Abierto
#25,762 2 comentarios 1 reacción 0 asignados Ver en GitHub
package: core type: bug
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/.github/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

- [ ] v4.x
- [X] v5.x
- [X] v6.x
- [ ] Nightly

### Current Behavior

iOS only: In my ion-header I have my toolbars one of which is fixed and then some more which are reused on multiple pages. To reuse them this toolbars are in a component and the component is included in the ion-header.
The safe area top padding is applied on the first fixed toolbar and the first toolbars in each component:

### Expected Behavior

I would expect that the safe area top padding is only applied to the first toolbar and not the other toolbars although they are the first toolbars in the component.

### Steps to Reproduce

Create a simple component which has some toolbars as content like:
`

Toolbar from Component 1


Toolbar from Component 2

`

Include it in an ion-header with a toolbar before the component:
`


Fix Toolbar



`

### Code Reproduction URL

[https://github.com/kaunstdadenga/ionic-ios-toolbar](url)

### Ionic Info

Ionic:

Ionic CLI : 6.17.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.2.2
@angular-devkit/build-angular : 14.1.2
@angular-devkit/schematics : 14.1.2
@angular/cli : 14.1.2
@ionic/angular-toolkit : 6.1.0

Capacitor:

Capacitor CLI : 4.0.1
@capacitor/android : 4.0.1
@capacitor/core : 4.0.1
@capacitor/ios : 4.0.1

Utility:

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

System:

NodeJS : v16.10.0 (/usr/local/bin/node)
npm : 7.24.0
OS : macOS Monterey

### Additional Information

Expected behaviour on an Android device:
![Expected_Screenshot_Android](https://user-images.githubusercontent.com/15046827/184881019-7fb09b62-ecba-4669-8420-f931cff18a15.jpg)

The actual behaviour on an iOS Device - see how the blue toolbar has an unnecessary padding top:
![Actual_Screenshot_ios](https://user-images.githubusercontent.com/15046827/184881024-bd21b023-277f-437c-a3a8-3b343a29544d.jpeg)

If I debug it via Safari I can see that also the first <ion-toolbar> in the <app-toolbar> receives the CSS for "ion-header ion-toolbar:first-of-type
![HTML_CSS_Debug](https://user-images.githubusercontent.com/15046827/184881085-a8300263-0fd5-4d07-a2ec-7c14294d9a84.png)

I played around and I guess something like "ion-header > ion-toolbar:first-of-type" should fix it, but I am not sure if this causes some sideeffects

For my productive App I now hardcode the padding in the component to 0px:
`ion-toolbar:first-of-type {
padding-top: 0px !important;
}`
But this only works as long as no component with a toolbar is the first one

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.