Fix Android UI cut-off by using injected safe-area CSS variables#146
Merged
PureWeen merged 1 commit intoPureWeen:mainfrom Feb 19, 2026
Conversation
The native Android code in MainPage.xaml.cs already injects --status-bar-height and --nav-bar-height CSS custom properties from WindowInsets, but no CSS rules referenced them. All safe-area CSS used env(safe-area-inset-*) which evaluates to 0 in MAUI's Android WebView, causing content to render behind the status bar and navigation bar. Update all safe-area CSS rules to use var(--status-bar-height, ...) and var(--nav-bar-height, ...) with env() as fallback for iOS. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Android, UI content renders behind the status bar and navigation bar (cut-off edges). The native code in
MainPage.xaml.csalready injects--status-bar-heightand--nav-bar-heightCSS custom properties fromWindowInsets, but no CSS rules referenced them. All safe-area CSS usedenv(safe-area-inset-*)which evaluates to0in MAUI's Android WebView.Fix
Updated 5 CSS rules across 5 files to use the injected Android variables with
env()as fallback for iOS:Pattern:
env(safe-area-inset-top, 0px)→var(--status-bar-height, env(safe-area-inset-top, 0px))