Skip to content
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: additional toolbars get unnecessary padding if placed in wrapper element #25762

Open
5 of 7 tasks
kaunstdadenga opened this issue Aug 16, 2022 · 2 comments
Open
5 of 7 tasks
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@kaunstdadenga
Copy link

kaunstdadenga commented Aug 16, 2022

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.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:
<ion-toolbar color="secondary"> <ion-text> Toolbar from Component 1 </ion-text> </ion-toolbar> <ion-toolbar color="danger"> <ion-text> Toolbar from Component 2 </ion-text> </ion-toolbar>

Include it in an ion-header with a toolbar before the component:
<ion-header> <ion-toolbar color="primary"> <ion-title> Fix Toolbar </ion-title> </ion-toolbar> <app-toolbar></app-toolbar> </ion-header>

Code Reproduction URL

https://github.com/kaunstdadenga/ionic-ios-toolbar

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

The actual behaviour on an iOS Device - see how the blue toolbar has an unnecessary padding top:
Actual_Screenshot_ios

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

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

@ionitron-bot ionitron-bot bot added the triage label Aug 16, 2022
@liamdebeasi liamdebeasi added the ionitron: needs reproduction a code reproduction is needed from the issue author label Aug 16, 2022
@ionitron-bot
Copy link

ionitron-bot bot commented Aug 16, 2022

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

@ionitron-bot ionitron-bot bot removed the triage label Aug 16, 2022
@amandaejohnston amandaejohnston self-assigned this Aug 25, 2022
@amandaejohnston amandaejohnston added triage and removed ionitron: needs reproduction a code reproduction is needed from the issue author labels Aug 25, 2022
@amandaejohnston
Copy link
Contributor

amandaejohnston commented Aug 25, 2022

Thanks for the issue! I'm able to reproduce this. The problem is as you pointed out: the second and third toolbars are wrapped in a custom component (<app-toolbar>) which causes the safe area CSS to activate. We can probably adjust the selector(s) to account for this possibility.

@amandaejohnston amandaejohnston changed the title bug: iOS toolbar in component applies bug: additional toolbars get unnecessary padding if placed in wrapper element Aug 25, 2022
@amandaejohnston amandaejohnston added package: core @ionic/core package type: bug a confirmed bug report labels Aug 25, 2022
@amandaejohnston amandaejohnston removed their assignment Aug 25, 2022
@ionitron-bot ionitron-bot bot removed the triage label Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

3 participants