-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS26] Apply view margins in title view #32205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kubaflo
merged 6 commits into
dotnet:inflight/current
from
kubaflo:net-26-navbar-margins
Mar 4, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7687182
[iOS26] Apply view margins in NavigationRenderer layout
kubaflo 7c1a019
Added a UITest
kubaflo a43b562
Applied agent's suggestions
kubaflo 42c3a92
Add NavigationPageTitleView margin snapshots
kubaflo 7798410
Apply PR review suggestions: defensive width guard and improved comments
kubaflo bcd7faa
Apply vertical margin to height to keep view within nav bar bounds
kubaflo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Binary file added
BIN
+23.2 KB
...Android.Tests/snapshots/android/NavigationPageTitleViewShouldRespectMargins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions
18
src/Controls/tests/TestCases.HostApp/Issues/Issue32200.xaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue32200"> | ||
| <NavigationPage.TitleView> | ||
| <HorizontalStackLayout | ||
| BackgroundColor="Blue" | ||
| HorizontalOptions="Fill" | ||
| VerticalOptions="Fill" | ||
| Margin="-20,0,0,0"> | ||
| <Label Text="1234567890abcdefghij"/> | ||
| </HorizontalStackLayout> | ||
| </NavigationPage.TitleView> | ||
| <Label Text="Hello, Issue 32200" | ||
| VerticalOptions="Center" | ||
| AutomationId="Label" | ||
| HorizontalOptions="Center"/> | ||
| </ContentPage> |
15 changes: 15 additions & 0 deletions
15
src/Controls/tests/TestCases.HostApp/Issues/Issue32200.xaml.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [XamlCompilation(XamlCompilationOptions.Compile)] | ||
| [Issue(IssueTracker.Github, 32200, "NavigationPage TitleView iOS 26", PlatformAffected.iOS)] | ||
| public class Issue32200NavigationPage : NavigationPage | ||
| { | ||
| public Issue32200NavigationPage() : base(new Issue32200()) { } | ||
| } | ||
| public partial class Issue32200 : ContentPage | ||
| { | ||
| public Issue32200() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
| } |
Binary file added
BIN
+10.1 KB
...stCases.Mac.Tests/snapshots/mac/NavigationPageTitleViewShouldRespectMargins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions
19
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32200.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue32200 : _IssuesUITest | ||
| { | ||
| public override string Issue => "NavigationPage TitleView iOS 26"; | ||
| public Issue32200(TestDevice device) : base(device) { } | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Navigation)] | ||
| public void NavigationPageTitleViewShouldRespectMargins() | ||
| { | ||
| App.WaitForElement("Label"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } |
Binary file added
BIN
+7.99 KB
...s.WinUI.Tests/snapshots/windows/NavigationPageTitleViewShouldRespectMargins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+27.5 KB
...ases.iOS.Tests/snapshots/ios-26/NavigationPageTitleViewShouldRespectMargins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+27.5 KB
...stCases.iOS.Tests/snapshots/ios/NavigationPageTitleViewShouldRespectMargins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect I think because if you force the height, then if there is a top margin it will be too tall. But maybe this is a feature? I think I would expect that whatever the default is, the margens push it IN or make it smaller.
EDIT
Well, maybe this is all right as margins are more moving the view around. But still, should it be allowed to leave the nav bar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is complicated because I think Apple doesn’t actually want developers to use the entire height of the navigation bar. That’s why there are those built-in paddings on all sides. Moreover, imo, they changed them in iOS 26. Allowing negative margins is kind of a workaround