Skip to content

Fix Android UI cut-off by using injected safe-area CSS variables#146

Merged
PureWeen merged 1 commit intoPureWeen:mainfrom
davidnguyen-tech:dev/davidnguyen-tech/android-safe-area-insets
Feb 19, 2026
Merged

Fix Android UI cut-off by using injected safe-area CSS variables#146
PureWeen merged 1 commit intoPureWeen:mainfrom
davidnguyen-tech:dev/davidnguyen-tech/android-safe-area-insets

Conversation

@davidnguyen-tech
Copy link
Contributor

Problem

On Android, UI content renders behind the status bar and navigation bar (cut-off edges). The native 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.

Fix

Updated 5 CSS rules across 5 files to use the injected Android variables with env() as fallback for iOS:

  • SessionSidebar.razor.css — mobile bar top padding
  • MainLayout.razor.css — flyout panel top padding
  • ExpandedSessionView.razor.css — input area bottom padding
  • Dashboard.razor.css — input area bottom padding
  • app.css — image viewer close button top position

Pattern: env(safe-area-inset-top, 0px)var(--status-bar-height, env(safe-area-inset-top, 0px))

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>
@PureWeen PureWeen merged commit c9959af into PureWeen:main Feb 19, 2026
@davidnguyen-tech davidnguyen-tech deleted the dev/davidnguyen-tech/android-safe-area-insets branch February 23, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants