Repository navigation
Description
Title: Translucent ion-header/ion-toolbar measures --ion-safe-area-top exactly once and never re-measures, breaking on platforms where the real value arrives asynchronously (Android edge-to-edge)
Prerequisites
- I have read the Contributing Guidelines
- I have searched for existing issues that already include this feature request, without success
Ionic Info
Ionic:
Ionic CLI : (not relevant, using @ionic/angular directly)
@ionic/angular : 8.8.16
Capacitor:
@capacitor/android : 8.5.0
@capacitor/core : 8.5.0
Platform: Android (Capacitor), targetSdk 35+/36, edge-to-edge (mandatory on this OS version, no opt-out).
Current Behavior
A translucent <ion-header [translucent]="true"> with a matching <ion-content [fullscreen]="true"> measures the app's --ion-safe-area-top CSS custom property exactly once, at component initialization, and caches whatever value it read at that moment. If the real value only becomes known after that initial measurement — which is unavoidable on Android, where the true status-bar inset is only available asynchronously via a native WindowInsets callback dispatched after Activity.onCreate() — the header permanently renders as if the safe area were 0, even once the CSS variable is later updated to the correct value.
Confirmed via a runtime probe logging both the CSS variable and the toolbar's measured position over time:
t0: --ion-safe-area-top=0px toolbarTop=n/a
t100ms: --ion-safe-area-top=24px toolbarTop=n/a
t500ms: --ion-safe-area-top=24px toolbarTop=0
t1500ms: --ion-safe-area-top=24px toolbarTop=0
t3000ms: --ion-safe-area-top=24px toolbarTop=0
The CSS variable is correctly updated to 24px by ~100ms and stays correct — but the toolbar's own layout never reflects it, at any point afterward, including 3 seconds later.
Expected Behavior
The header should react to changes in --ion-safe-area-top (and the other --ion-safe-area-* variables) after initialization — e.g. via a MutationObserver on the CSS custom property, or by re-measuring on window resize/orientation events, rather than caching a one-time JS measurement. This would make translucent headers correctly handle any platform/runtime where the true safe-area value isn't synchronously available at component init — which, going forward, includes Android, now that edge-to-edge is OS-mandatory there (Android 15+) and Capacitor's WebView doesn't populate env(safe-area-inset-*) for the general status bar (only for display cutouts — a separate, narrower case that iOS's WKWebView doesn't distinguish this way).
Steps to Reproduce
- Capacitor Android app, targetSdk 35+.
- Native side: apply the real status-bar inset to the WebView late (e.g. via a
WindowInsetslistener registered on the Activity's decor view, since — separately — listening directly on the WebView itself receives all-zero insets on Capacitor; see companion issue filed againstcapacitor-android), pushing the correct value into--ion-safe-area-topviadocument.documentElement.style.setProperty(...)once it's known. - Observe: even though the CSS variable is now correct, any
[translucent]="true"ion-headerpresent at that point continues to render as if it were0— content still appears under the status bar. - A plain (non-translucent) header, or a completely fresh page navigated to after the value is corrected, is unaffected — only headers that existed at/before the mismeasurement stay wrong, consistent with a cached one-time read rather than a live calculation.
Code Reproduction Link
Happy to put together a minimal Capacitor+Ionic Angular repro if useful — the behavior above was observed in a real app, not yet isolated into a standalone reproduction repo.
Ionic Framework Info
Framework: Angular (@ionic/angular 8.8.16)
Capacitor: 8.5.0
Platform: Android, targetSdk 36
Metadata
Metadata
Assignees
Labels
Type
Fields
Stage
Activity
ionitron-bot commentedon Aug 7, 2026
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.
ShaneK commentedon Aug 7, 2026
Hey, thanks for the issue report! I'd love to take a look at fixing this issue for you, but to make this issue a lot smoother and remove some of the guess work it really helps to have a reproduction. Please let me know when you've added one and I'll check it out!
schallm commentedon Aug 8, 2026
Minimal reproduction: https://gist.github.com/schallm/e54c2b8f96a385e024de60382f8a0e1a
Live preview (no download needed): https://gistpreview.github.io/?e54c2b8f96a385e024de60382f8a0e1a/index.html
It's a single self-contained HTML file loading
@ionic/corefrom a CDN (no framework, no build step) with atranslucention-header+fullscreenion-content.--ion-safe-area-topstarts at0px(matching the real device's initial state before the native inset callback fires), then ~800ms after load it's updated to24pxviadocument.documentElement.style.setProperty(...)— simulating the async arrival that happens for real on Android edge-to-edge.A live probe logs
--ion-safe-area-topandion-toolbar'sgetBoundingClientRect().topto the page and console every second or so. Console output:The CSS variable updates and holds correctly at
24px, but the toolbar's measured position never changes from0at any point afterward — visually the header stays pinned to the very top of the viewport instead of dropping below the (simulated) status bar. There's a "Re-run" button on the page to trigger the update again manually if you want to poke at it further.This isolates the bug down to
ion-header/ion-toolbaritself — no Capacitor, no native code, no Android involved. Let me know if a different reproduction shape would be more useful.ShaneK commentedon Aug 10, 2026
Thank you so much for your report and reproduction!
I have a PR up to address this issue. If you want to try it out before we merge and release it, you can use this dev build:
ShaneK commentedon Aug 12, 2026
Thanks for highlighting this issue, this is fixed now as part of v8.8.18!
fix(core): update offsets when safe-area insets arrive late (ionic-te…
schallm commentedon Aug 15, 2026
Confirmed this works. Thanks for resolving the issue!
ionitron-bot commentedon Sep 14, 2026
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
fix(core): update offsets when safe-area insets arrive late (ionic-te…