Repository navigation
[WIP] Fix Shell flyout background overlapping custom TitleBar on Windows - #40717
SuthiYuvaraj wants to merge 3 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| #pragma warning restore CS0618 // Type or member is obsolete | ||
| }; | ||
|
|
||
| #if !WINDOWS |
There was a problem hiding this comment.
[moderate] Regression Prevention and Test Coverage - The duplicate-title-bar-painting part of #31510 has no discriminating regression assertion. Restoring these Windows background bindings would leave all three new tests' clip and flyout/button-brush assertions unchanged, while the default template grid and native ContentPanel would again both paint #85FFFFFF, reproducing the brighter title-bar region over Mica. Cover the default template's single background layer, including background updates, or assert the composited title-bar appearance for the original translucent-background scenario.
| PaneDisplayMode == NavigationViewPaneDisplayMode.Top) | ||
| { | ||
| if (_titleBarSplitView.Clip == _titleBarClip) | ||
| _titleBarSplitView.Clip = _originalSplitViewClip; |
There was a problem hiding this comment.
[moderate] Native Platform Defaults Preservation - On initial template application without a custom title bar, both _titleBarClip and a null native Clip compare equal, so this restoration writes a local null even though MAUI never installed a clip. For a customized native template with a one-way RootSplitView.Clip binding whose initial value is null, that assignment replaces the binding; subsequent geometry updates no longer clip the SplitView. Require a non-null owned _titleBarClip before restoring, including the template-cleanup branch, so untouched native defaults remain untouched.
Selected Tests
🧪 Test selection — click to expand
🧪 UI tests —
|
| Platform | Categories |
|---|---|
| Windows | FlyoutPage, Shell1, Shell2, Window |
📊 Results — succeeded: 5 passed, 0 failed of 5 jobs
🔗 All test results · Build logs
| Job | Result |
|---|---|
| Build UITests Windows Sample App Build Sample App (Windows) | ✅ succeeded |
| WinUI UITests Controls FlyoutPage | ✅ succeeded |
| WinUI UITests Controls Shell1 | ✅ succeeded |
| WinUI UITests Controls Shell2 | ✅ succeeded |
| WinUI UITests Controls Window | ✅ succeeded |
🧪 Device tests — Controls.FlyoutPage, Controls.Shell, Controls.Window, Core.FlyoutView +1 on Windows
✅ maui-pr-devicetests #1702769 passed.
GPT-6.2 Sol: Run Windows device tests for the new Shell regressions and the affected FlyoutPage and Window paths.
MAI Code 2: Windows-only custom TitleBar and Shell flyout clipping changes; run Controls Shell/Window and Core Window device tests on Windows.
🧪 Ran — 5 categories on Windows
| Platform | Categories |
|---|---|
| Windows | Controls.FlyoutPage, Controls.Shell, Controls.Window, Core.FlyoutView, Core.Window |
📊 Results — succeeded: 2 passed, 0 failed of 2 jobs
🔗 All test results · Build logs
| Job | Result |
|---|---|
| net11.0 Windows Helix Tests - Build Build Device Tests (Windows) | ✅ succeeded |
| net11.0 Windows Helix Tests Run DeviceTests Windows | ✅ succeeded |
⏭️ Skipped — what neither suite runs
UI tests — 73 categories, 3 platforms
Platforms not run: Android, iOS, MacCatalyst
Categories not run: Accessibility, ActionSheet, ActivityIndicator, Animation, AppLinks, Border, BoxView, Brush, Button, CarouselView, CollectionView1, CollectionView2, CollectionView3, CollectionView4, CollectionView5, CollectionView6, CollectionView7, Cells, CheckBox, ContextActions, CustomRenderers, DatePicker, Dispatcher, DisplayAlert, DisplayPrompt, DragAndDrop, Entry, Editor, Effects, Essentials, Focus, Fonts, Frame, Gestures, GraphicsView, Image, ImageButton, IndicatorView, InputTransparent, IsEnabled, IsVisible, Label, Layout, Lifecycle, ManualReview, Maps, Navigation, Page, Performance, Picker, ProgressBar, RadioButton, RefreshView, SafeAreaEdges, Shadow, ScrollView, SearchBar, Shape, Slider, SoftInput, Stepper, Switch, SwipeView, TabbedPage, TableView, TimePicker, TitleView, ToolbarItem, Triggers, ViewBaseTests, VisualStateManager, WebView, Material3
Each skipped platform and category is listed as a maui-pr-uitests (skipped) … status on this commit. Use /azp run maui-pr-uitests for the full suite.
Device tests — 100 categories, 3 platforms
Platforms not run: Android, iOS, MacCatalyst
Categories not run: Controls.Accessibility, Controls.Animations, Controls.Application, Controls.Behavior, Controls.Border, Controls.BoxView, Controls.Button, Controls.CarouselView, Controls.CheckBox, Controls.CollectionView, Controls.Compatibility, Controls.ContentView, Controls.DatePicker, Controls.Dispatcher, Controls.Editor, Controls.Element, Controls.Entry, Controls.FlexLayout, Controls.Frame, Controls.Gesture, Controls.HybridWebView, Controls.Image, Controls.Label, Controls.Layout, Controls.Lifecycle, Controls.Map, Controls.Mapper, Controls.Memory, Controls.MenuFlyout, Controls.Modal, Controls.NavigationPage, Controls.Page, Controls.PageTransitions, Controls.Path, Controls.Picker, Controls.RadioButton, Controls.RefreshView, Controls.ScrollView, Controls.SearchBar, Controls.Shape, Controls.Slider, Controls.SwipeView, Controls.Switch, Controls.TabbedPage, Controls.TemplatedView, Controls.TextInput, Controls.Toolbar, Controls.View, Controls.VisualElement, Controls.VisualElementTree, Controls.WebView, Controls.WindowOverlay, Controls.Xaml, Core.ActivityIndicator, Core.Animation, Core.Application, Core.Border, Core.BoxView, Core.Button, Core.CheckBox, Core.ContentView, Core.DatePicker, Core.Dispatcher, Core.Editor, Core.Element, Core.Entry, Core.FlowDirection, Core.Fonts, Core.Formatting, Core.Graphics, Core.GraphicsView, Core.Image, Core.ImageButton, Core.ImageSource, Core.IndicatorView, Core.Label, Core.Layout, Core.Lifecycle, Core.MauiContext, Core.Memory, Core.NavigationPage, Core.Page, Core.Picker, Core.ProgressBar, Core.RadioButton, Core.RefreshView, Core.ScrollView, Core.SearchBar, Core.ShapeView, Core.Slider, Core.Stepper, Core.SwipeView, Core.Switch, Core.TimePicker, Core.View, Core.WebView, Core.WindowOverlay, Graphics, Essentials, BlazorWebView
Each skipped platform and project is listed as a maui-pr-devicetests (skipped) … status on this commit. Use /azp run maui-pr-devicetests for the full suite.
🤖 Why these tests — AI rationale (GPT-6.2 Sol + MAI Code 2)
UI tests
Each model chose independently; every test that runs was selected by at least one of them.
| Platform | GPT-6.2 Sol | MAI Code 2 |
|---|---|---|
| Android | — | — |
| iOS | — | — |
| MacCatalyst | — | — |
| Windows | Shell1, Shell2, FlyoutPage, Window |
Shell1, Shell2, Window |
GPT-6.2 Sol — Run Windows Shell, FlyoutPage, and Window UI tests for the custom title-bar rendering and clipping changes.
- RootNavigationView clips the Shell flyout and is also used by FlyoutPage.
- WindowRootView updates clipping on title-bar and content changes; TitleBar avoids double painting.
- The changes are Windows-only; unrelated UI categories are excluded.
MAI Code 2 — Windows-only Shell flyout and custom TitleBar clipping fix; run Shell and Window UI tests on Windows.
- RootNavigationView and WindowRootView are Windows-only changes affecting Shell flyout and TitleBar layering; the UI run therefore targets Shell and Window on Windows.
- The TitleBar template change is compiled out on Windows but removes the duplicate Windows paint operation, which is covered by the Window scenario.
- Other platforms are intentionally excluded because their TitleBar behavior is unchanged.
- No categories outside Shell and Window are closely coupled to the clipping and background changes.
Device tests
Each model chose independently; every test that runs was selected by at least one of them.
| Platform | GPT-6.2 Sol | MAI Code 2 |
|---|---|---|
| Android | — | — |
| iOS | — | — |
| MacCatalyst | — | — |
| Windows | Controls.Shell, Controls.FlyoutPage, Core.FlyoutView, Controls.Window, Core.Window |
Controls.Shell, Controls.Window, Core.Window |
GPT-6.2 Sol — Run Windows device tests for the new Shell regressions and the affected FlyoutPage and Window paths.
- Controls.Shell runs the new clipping, transparency, and page-replacement regressions.
- FlyoutPage and FlyoutView share RootNavigationView.
- Controls.Window and Core.Window cover title-bar and root-view behavior; non-Windows platforms and unrelated units are excluded.
MAI Code 2 — Windows-only custom TitleBar and Shell flyout clipping changes; run Controls Shell/Window and Core Window device tests on Windows.
- The modified Windows Shell device tests directly exercise flyout clipping and custom TitleBar background transitions, selecting Controls.Shell.
- WindowRootView and title-bar handling affect window integration, selecting Controls.Window and Core.Window.
- Android, iOS, and Mac Catalyst are excluded because the runtime implementation changes are Windows-only.
- The change is limited to Shell/Window title-bar rendering rather than base layout or shared infrastructure, so no full run is needed.
Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.
…40767) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change Correct the Windows Shell flyout-clipping device test's native-layout prerequisites without changing product behavior, skipping tests, adding retries, or weakening its regression assertions. Stop retaining the first `DataTemplate` instance. WinUI can prepare template instances outside the live flyout or replace them. A handler alone does not establish visual-tree membership or completed arrangement. Select the loaded, positively arranged flyout item from the actual Shell visual tree, then run the unchanged non-null clip and exact rounded-width assertions. The readiness wait does not wait for the assertion to become true. Existing-fix search covered open and recently merged PRs. #40717 concerns custom TitleBar overlap, not flyout-template selection. #40692 addresses a different ContentButton reparenting test, and #40727 addresses Windows CarouselView position updates; neither is duplicated here. #### Validation and scope correction - **Baseline red = main 1703707**, head `34964bfc72`. Shell fails in both packaged attempts and the second unpackaged attempt; the first unpackaged attempt passes. Raw first-attempt logs: 787/788; second-attempt logs: 962/960. Both Windows Shell jobs also fail in migration PR #40661 build 1703676 (logs 757/766). - **Fix = PR CI 1703831** at `1e894622fe`: Windows Shell category **92 passed, 0 failed, 0 skipped in each mode**, logs [757](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1703831/logs/757?api-version=7.1) and [758](https://dev.azure.com/dnceng-public/public/_apis/build/builds/1703831/logs/758?api-version=7.1). The unchanged Shell patch compiled and executed on Windows in that CI run. - The initial commit also attached the ContentButton replacement test to a native window. **CI disproved that attempted fix**: build 1703831 Core logs 621/625 still report expected frame `{X=5 Y=5 Width=170 Height=80}`, actual zero. That Button change has been reverted in a normal follow-up commit; the net PR diff now contains only `ShellTests.Windows.cs`. - Static tracing of the Button path confirms `SetVirtualView(second)` updates the panel's `CrossPlatformLayout`, maps the expected replacement native content, and measures its requested size. `ContentButtonLayout.Arrange` would assign the presented content's managed frame through `StubBase.Arrange`; the current failure logs do not prove why that arrange path is not reflected in the frame. No speculative timing workaround or product fix is included. - `git diff --exit-code 34964bf -- src/Core/tests/DeviceTests/Handlers/ContentButton/ContentButtonWindowsTests.Windows.cs` — **passed**, proving the Button file is restored exactly to the baseline. - `git diff --check` — **passed**. - Initial local `dotnet build Microsoft.Maui.BuildTasks.slnf -v:q` — **passed**. Initial `dotnet format whitespace Microsoft.Maui.sln --no-restore --include src/Core/tests/DeviceTests/Handlers/ContentButton/ContentButtonWindowsTests.Windows.cs src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Windows.cs --verbosity quiet` — **passed**. - Initial Windows cross-host build attempts on macOS were blocked by native tooling: Core's Windows-only build reached `MakePri.exe` and failed with exec format error; Controls' fallback with `AppxGeneratePriEnabled=false` reached the native WinUI XAML compiler and failed without `output.json`. No local Windows compilation or runtime success is claimed. - Revert/restore runtime verification **not run (no Windows host)**. The Button source restoration is mechanically verified; updated PR CI is requested separately. CarouselView native-centering and HybridWebView coexistence failures did not repeat across baseline attempts and passed the migration PR comparison, so they remain unchanged. The recurrent NavigationPage crash had `SettingTitleIconImageSourceDoesntCrash` in flight, but no dump and an unproven cause; it is neither patched speculatively nor classified as infrastructure. PageTransitions is outside this PR's scope. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Addresses the recurring Windows Shell flyout-clipping device-test failure in builds 1703707 and 1703676. No separate tracking issue; preserves regression coverage for #19542. The ContentButton replacement failure remains unresolved and is no longer changed by this PR. ### Let AI finish this PR - [ ] **Let the MAUI agent address review feedback and fix remaining issues on this PR.** Maintainers still decide whether it is merged. For PRs from forks, the agent opens a follow-up PR that keeps your commits. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
MAUI Autopilot — Stopped@kubaflo ❌ The last fix round found nothing more it could fix. Decide how to continue, or comment WhyNo fixes were published: the append-only push rejected out-of-scope files in the existing branch history, even though both new commits touch only |
Target Branch
mainnet11, for reviewFor .NET 11 fixes, only a maintainer retargets the approved PR to the active
inflight lane and merges it after CI validates that final base. Do not merge
individual fixes directly into
net11; agents must not retarget or merge.Issue Description
On Windows, the Shell flyout extends behind a custom TitleBar. When both the flyout and title bar use semi-transparent backgrounds, their backgrounds overlap and are composited multiple times, causing the title-bar region to appear noticeably brighter than expected.
Root Cause
The issue is caused by two separate background paint operations occurring in the title-bar region:
When these layers overlap, semi-transparent colors are composited multiple times, resulting in the brighter appearance.
Description of Change
This PR prevents the Shell flyout background from rendering behind a custom TitleBar on Windows and removes an additional title-bar background paint operation.
These changes prevent overlapping background layers and provide a more consistent appearance for semi-transparent title-bar backgrounds.
Issues Fixed
Fixes #31510
Tested the behaviour in the following platforms
Output Screenshot