-
Notifications
You must be signed in to change notification settings - Fork 2k
[Mac] Fixed the Issue with the TitleBar TrailingContent not being properly aligned #36541
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,10 @@ internal static void IgnoreLayoutSafeArea(this Layout layout) | |
| { | ||
| IgnoreLayoutSafeArea(childLayout); | ||
| } | ||
| else if (child is IContentView contentView && contentView.Content is Layout contentLayout) | ||
|
Ahamed-Ali marked this conversation as resolved.
Outdated
Ahamed-Ali marked this conversation as resolved.
Outdated
Ahamed-Ali marked this conversation as resolved.
Outdated
Ahamed-Ali marked this conversation as resolved.
Outdated
|
||
| { | ||
| IgnoreLayoutSafeArea(contentLayout); | ||
| } | ||
|
Ahamed-Ali marked this conversation as resolved.
Outdated
Comment on lines
+17
to
+27
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[minor] Diff hygiene — This change removes the trailing newline from a previously well-formed file ( |
||
| } | ||
| } | ||
| } | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[minor] Build & MSBuild — This change deletes the trailing newline at end of file (
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[minor] Build & MSBuild hygiene — This edit drops the trailing newline at end of file (
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[minor] Build & MSBuild — mechanical formatting issues introduced by this hunk that will trip the format/whitespace check rather than being a style preference: line 17 is indented with spaces instead of a tab, lines 20–26 carry a stray leading space before their tabs, and the trailing newline at end of file was removed (
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
💡 [minor] Build & Formatting — Two mechanical issues introduced by this hunk that
Running
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
💡 Suggestion — [minor] Build: the added block mixes leading spaces and tabs (
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[minor] Complexity Reduction — The trailing newline was removed from the end of the file ( |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 29516, "Issue with the TitleBar TrailingContent not being properly aligned on macOS", PlatformAffected.macOS)] | ||
| public class Issue29516 : ContentPage | ||
| { | ||
| TitleBar _titleBar; | ||
| public Issue29516() | ||
| { | ||
| Content = new VerticalStackLayout | ||
| { | ||
| Children = | ||
| { | ||
| new Label | ||
| { | ||
| Text = "This is a test for the TitleBar TrailingContent alignment issue on macOS.", | ||
| AutomationId="ContentLabel", | ||
| } | ||
| } | ||
| }; | ||
| _titleBar = new TitleBar | ||
| { | ||
| Title = ".NET MAUI", | ||
| BackgroundColor = Colors.Blue, | ||
| HeightRequest = 50, | ||
| Content = new SearchBar | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention and Test Coverage — The repro is built entirely in the object initializer, so all children exist before |
||
| Placeholder = "TitleBar Content", | ||
| PlaceholderColor = Colors.White, | ||
| BackgroundColor = Colors.Blue, | ||
| MaximumWidthRequest = 300, | ||
| HorizontalOptions = LayoutOptions.Fill, | ||
| VerticalOptions = LayoutOptions.Center | ||
| }, | ||
|
Ahamed-Ali marked this conversation as resolved.
|
||
| TrailingContent = new HorizontalStackLayout | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention and Test Coverage — The repro page exercises exactly one shape:
Adding those two slots to this same page would make the screenshot baseline discriminate between "safe-area ignored everywhere in the title bar" and "safe-area ignored only for the one-level-deep case". As written, a future regression that re-narrows the traversal to the one covered shape would still pass. Minor test-robustness note (
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This page builds
Per the MAUI regression guidance, a bug fix should enumerate and cover the adjacent scenarios, not just the reported one — most reverts come from the neighbouring case. Please extend this page (or add sibling cases) so the test suite would actually catch the gaps above.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention and Test Coverage — The repro wraps the |
||
| { | ||
| Spacing = 8, | ||
| Margin = new Thickness(4), | ||
| Children = | ||
| { | ||
| new Border | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention — coverage only exercises the single nesting shape the new The changed method is
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention — The repro exercises only the single shape the fix happens to handle: Recommendation: add a fast unit test (Controls.Core.UnitTests) that builds a nested tree and asserts
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
💡 Suggestion — [moderate] Regression Prevention and Test Coverage: the repro exercises exactly one shape — |
||
| { | ||
| Content = new StackLayout | ||
| { | ||
| VerticalOptions = LayoutOptions.Center, | ||
| BackgroundColor = Colors.Red, | ||
| Children = | ||
| { | ||
| new Label { Text = "TrailingContent" } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention —
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention and Test Coverage — The reproduction subtree that the fix is supposed to correct carries no |
||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| } | ||
|
|
||
| protected override void OnAppearing() | ||
| { | ||
| base.OnAppearing(); | ||
|
|
||
| if (Window is not null) | ||
| { | ||
| Window.TitleBar = _titleBar; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention and Test Coverage —
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention and Test Coverage — |
||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #if MACCATALYST || WINDOWS | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
💡 [minor] Platform Scoping / Test Cost — The test is compiled for The production change only sets If the Windows coverage is intentional (guarding against a cross-platform regression), a one-line comment saying so would be helpful; otherwise consider narrowing to Also a nit: this file uses 4-space indentation while the rest of
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Cross-Platform Behavioral Consistency — The issue is scoped to macOS (the HostApp page declares |
||
| // TitleBar is only available on Mac Catalyst and Windows. https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/titlebar?view=net-maui-9.0 | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue29516 : _IssuesUITest | ||
| { | ||
| public Issue29516(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "Issue with the TitleBar TrailingContent not being properly aligned on macOS"; | ||
|
|
||
| [Test] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[major] Regression Prevention and Test Coverage — The only coverage for this fix is a screenshot comparison, which is both currently unrunnable (see baseline size mismatch below) and non-discriminating: a screenshot diff cannot tell a reviewer why it changed, and if it ever regresses the usual remedy is re-recording the baseline, which silently erases the regression signal. The changed code ( [Fact]
public void IgnoreLayoutSafeAreaRecursesThroughContentViews()
{
var inner = new StackLayout { Children = { new Label() } };
var root = new HorizontalStackLayout { Children = { new Border { Content = inner } } };
root.IgnoreLayoutSafeArea();
Assert.True(inner.IgnoreSafeArea);
}Please add the unit test covering the exact nesting from #29516 (and, per the finding on |
||
| [Category(UITestCategories.Window)] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[major] Regression Prevention and Test Coverage — The production change is pure shared, platform-agnostic C# ( A
Per the repo's test-type preference (unit > device > UI), please add the unit test; the screenshot test can stay as a visual smoke check once its baseline is validated. |
||
| public void TitleBarTrailingContentShouldRenderProperly() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[major] Regression Prevention and Test Coverage — The behavior changed here is pure shared managed code in
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Gestures / Regression Prevention — The test's precondition does not cover what it claims to verify. |
||
| { | ||
| App.WaitForElement("ContentLabel"); | ||
|
Ahamed-Ali marked this conversation as resolved.
Ahamed-Ali marked this conversation as resolved.
Ahamed-Ali marked this conversation as resolved.
Ahamed-Ali marked this conversation as resolved.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention and Test Coverage — This waits for
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention — The test waits for
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention — the test's precondition is not verified. Give the trailing
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Please give the trailing content an
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[major] Regression Prevention / Test Coverage — The test does not verify its own precondition. Recommendation: give the trailing-content label an
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[major] Regression Prevention / Gestures-style precondition verification — The test's only synchronization point is Two consequences: (a) the screenshot can be taken while the title bar content is still settling, which is a plausible contributor to the 1.59% diff and to future flakiness; (b) the assertion cannot discriminate the bug — the page-body label renders identically whether or not the Give the
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There is also no
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[critical] Regression Prevention and Test Coverage — This test does not currently demonstrate the bug or the fix. Gate evidence (Mac Catalyst, |
||
| VerifyScreenshot(includeTitleBar: true); | ||
|
Ahamed-Ali marked this conversation as resolved.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[moderate] Regression Prevention and Test Coverage — The recommended fix is to add VerifyScreenshot(includeTitleBar: true, retryTimeout: TimeSpan.FromSeconds(5));
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[major] Regression Prevention and Test Coverage — This test does not discriminate the fix. Per the pipeline gate run (
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[critical] Regression Prevention and Test Coverage — The gate is a definitive failure on this assertion:
Given the traversal gap flagged on
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
❌ Error — [critical] Regression Prevention and Test Coverage: this test does not discriminate the fix, per the gate run on Mac Catalyst:
Two separate problems:
As submitted, CI cannot be green and the change is unverified.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[major] Regression Prevention and Test Coverage — The committed Mac baseline cannot match what this call captures, so the test fails regardless of the fix. Re-record both baselines from an actual |
||
| } | ||
| } | ||
| #endif | ||
Uh oh!
There was an error while loading. Please reload this page.