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

CSS4 box-shadow variable for toolbar-background #17544

Open
Spinnenzunge opened this issue Feb 20, 2019 · 2 comments
Open

CSS4 box-shadow variable for toolbar-background #17544

Spinnenzunge opened this issue Feb 20, 2019 · 2 comments
Labels
package: core @ionic/core package type: feature request a new feature, enhancement, or improvement

Comments

@Spinnenzunge
Copy link

Feature Request

Please add a css4 box-shadow variable for ion-header ion-toolbar:last-child or ion-footer ion-toolbar:first-child.

Ionic version:
[x] 4.x

Describe the Feature Request
Ionic 4 has no satisfying option to add a box-shadow to the header in iOS mode. Adding a box-shadow to the ion-toolbar or ion-header does not work, because it leaves an ugly navigation animation if the header is not the same size on the parent / child pages.

ionic4-shadow-problem

Describe Preferred Solution
CSS4 box-shadow variable for ion-header ion-toolbar:last-child or ion-footer ion-toolbar:first-child. This was the fix for adding a good looking box-shadow to toolbars in Ionic 3 and is prevented with the new shadow DOM.

Additional Context
The solution given in #16895 does not fix the problem because then the navigation animation looks bad.

@ionitron-bot ionitron-bot bot added the triage label Feb 20, 2019
@lagneaucdc
Copy link

lagneaucdc commented Mar 5, 2019

Hi Spinnenzunge, I got the same issue and I ended adding a ion-title in my ion-header, at the same level than the ion-toolbar. This is not the cleanest solution, but it works.
I give this ion-title a "shadow" attribute, that I style in the CSS (ion-title[shadow])

<ion-header no-border> <ion-toolbar> <ion-title>About</ion-title> </ion-toolbar> <ion-title shadow></ion-title> </ion-header>

As the ion-title(s) tags are animated, it fixes the problem.

Hope it helps :)

@Spinnenzunge
Copy link
Author

Spinnenzunge commented Mar 6, 2019

Hi lagneaucdc.

This is an interesting approach and would probably also work with multiple ion-toolbar elements.
My main Problem is, that you would have to add extra markup on every page you have a header where you want the shadow in. Furthermore it would probably leave an ugly empty element for screen-readers (could be hidden with aria-hidden tough, but even more markup then).

I think i will pass on the header shadow until it is properly implementable with a css 4 variable (It was possible to get itt running really well in ionic 3 with some custom CSS)

Could look something like this:

:root[mode=ios] {
   ion-header {
      ion-toolbar {
         &:last-child {
            .toolbar-background {
               box-shadow: var(--box-shadow);
            }
         }
      }
   }
}

*edit: edited some code to not sound too cheesy

@liamdebeasi liamdebeasi added package: core @ionic/core package type: feature request a new feature, enhancement, or improvement labels Sep 21, 2020
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: feature request a new feature, enhancement, or improvement
Projects
None yet
Development

No branches or pull requests

3 participants