Skip to content

Fix safe area calcs for navigation page#21221

Merged
MrJul merged 5 commits into
masterfrom
fix_navigation_page_padding
Apr 20, 2026
Merged

Fix safe area calcs for navigation page#21221
MrJul merged 5 commits into
masterfrom
fix_navigation_page_padding

Conversation

@emmauss

@emmauss emmauss commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

What does the pull request do?

Fixes NavigationPage safe area calculations. Safe area padding now considers the nav bar height.

What is the current behavior?

NavBar height doesn't consider the safe area, so when it's set, the extra padding occupies most of the NavBar height, leaving little room for the header.

What is the updated/expected behavior with this PR?

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #21220

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes NavigationPage safe-area handling so the navigation bar height accounts for the top safe-area inset (preventing the safe-area padding from consuming most of the nav bar’s usable header space), addressing #21220.

Changes:

  • Adjusts safe-area propagation so CurrentPage.SafeAreaPadding is computed using a modified safe-area input depending on nav bar visibility.
  • Updates EffectiveBarHeight to include SafeAreaPadding.Top.
  • Recomputes effective bar height during safe-area updates.

Comment thread src/Avalonia.Controls/Page/NavigationPage.cs Outdated
Comment thread src/Avalonia.Controls/Page/NavigationPage.cs Outdated
Comment thread src/Avalonia.Controls/Page/NavigationPage.cs Outdated
@MrJul MrJul added bug backport-candidate-12.0.x Consider this PR for backporting to 12.0 branch labels Apr 20, 2026

@MrJul MrJul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MrJul MrJul enabled auto-merge April 20, 2026 11:47
@MrJul MrJul added this pull request to the merge queue Apr 20, 2026
@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.1.999-cibuild0064932-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

Merged via the queue into master with commit 7adc66d Apr 20, 2026
11 checks passed
@MrJul MrJul deleted the fix_navigation_page_padding branch April 20, 2026 14:57
MrJul pushed a commit to MrJul/Avalonia that referenced this pull request Apr 28, 2026
* fix safe area calcs for navigation page

* update nav bar effective height on safe area change

* reset nav bar height if visibility changes

* add tests
@MrJul MrJul added backported-12.0.x and removed backport-candidate-12.0.x Consider this PR for backporting to 12.0 branch labels Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DrawerPage safe area is incorrect in some scenarios

4 participants