I have been trying for a while to get the new translucent (i.e. backdrop-filter based blur) header feature to work in Ionic 4. I have verified that backdrop-filter does indeed work, both on the desktop in Chrome as well as on devices, as I have used it myself in other custom CSS styling of other parts of my ui. However the header feature does not seem to work.
I have my pages set up using translucent
on the header and fullscreen
on the content, as per the documentation for ionic 4:
<ion-header translucent>
<ion-toolbar>
<ion-buttons slot="start" *ngIf="authorities.current$ | async">
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>
<img src="assets/images/img_main.png" alt="">
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content fullscreen>
I have also tried tweaking some of the ionic standard styles, to make certain elements in ionic transparent (as recommended by other threads on various forums on this subject) but to no avail:
:host {
ion-header {
ion-toolbar {
--background-color: transparent;
--ion-color-base: transparent !important;
}
}
ion-button {
--background: var(--dark-red);
--background-activated: var(--darker-red);
--background-focused: var(--dark-red);
--background-hover: var(--dark-red);
}
}
There was a single, short period of time where suddenly the tranclucent header started to work when testing the app in the browser on my desktop. However when it worked, the z-layering appeared to get screwed up as well. I mentioned I had my own custom styles with backdrop-filter configured with similar blurring (blur(20) actually, same as I believe the header is supposed to be using). So while most of the page contents was properly scrolling under the header and the translucency effect was working, all of my own elements styled with backdrop-filter scrolled OVER the header, obscuring it. Interestingly, when my backdrop-filtered elements were on top of the header, they were properly blurring the page contents…but the header was being completely ignored.
I do not know what happened to cause this strange coincidental quirky behavior, but it was the only time I’ve ever seen the ionic 4 translucent header effect actually work. Considering that there seemed to be a z-index problem at the time, I wonder if the default ionic 4 styles for the header may have a z-indexing problem? In any case, the design of the app I am working on was heavily contingent on these translucency effects, and we are really hoping there is a solution to the problem. Any insight would be greatly appreciated.