Skip to content

[WIP] Fix Shell flyout background overlapping custom TitleBar on Windows - #40717

Draft
SuthiYuvaraj wants to merge 4 commits into
net11from
Fix-31510
Draft

SuthiYuvaraj wants to merge 4 commits into
net11from
Fix-31510

Conversation

@SuthiYuvaraj

Copy link
Copy Markdown
Contributor

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

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.

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:

  1. The custom TitleBar background is rendered through both the inner grid background binding and the native view background mapping.
  2. The Shell flyout background is applied to the NavigationView pane and can render into the title-bar area because the underlying SplitView is not clipped below the custom title bar.
    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.

  • Clips the SplitView below the custom title bar so the flyout background does not render in the title-bar area.
  • Applies this clipping only when a MAUI Window.TitleBar is present and restores the original behavior when it is removed.
  • Removes the Windows-specific inner title-bar background binding to avoid painting the title-bar background twice.
    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

  • Android
  • Windows
  • iOS
  • Mac

Output Screenshot

Before Issue Fix After Issue Fix
Before Fix After Fix

@github-actions

This comment has been minimized.

@SuthiYuvaraj SuthiYuvaraj added the community ✨ Community Contribution label Nov 27, 2026
@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Nov 27, 2026
@azure-pipelines

This comment has been minimized.

@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot 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.

Expert Review — 2 findings

Reviewed commit 76cd610.

See inline comments for details.

@github-actions

This comment has been minimized.

kubaflo added a commit that referenced this pull request Nov 28, 2026
…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>
@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/autopilot-running MAUI Autopilot loop is running; remove this label to stop it label Dec 1, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) and removed s/autopilot-running MAUI Autopilot loop is running; remove this label to stop it s/autopilot-fixing MAUI Autopilot: fixing review findings or failing tests (GPT-6.2 Sol vs MAI Code 2) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

MAUI Autopilot — Stopped

@kubaflo ❌ The last fix round found nothing more it could fix. Decide how to continue, or comment /review autopilot to run it again.

Why

No fixes were published: the append-only push rejected out-of-scope files in the existing branch history, even though both new commits touch only src/. The review threads remain open.

[Run](https://github.com/dotnet/maui/actions/runs/46548564670).

@github-actions github-actions Bot added the s/autopilot-needs-maintainer-decision MAUI Autopilot stopped: a maintainer needs to decide how to continue label Dec 1, 2026
@vishnumenon2684

This comment has been minimized.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Selected Tests

@vishnumenon2684 — AI-selected UI tests and device tests (GPT-6.2 Sol + MAI Code 2) for commit 84b04067.

Result FAILED Platforms Windows Tests 4 UI, 3 device Commit 84b04067


🧪 Test selection — click to expand
Suite Result Selected Build
UI tests ✅ passed 4 of 77 categories maui-pr-uitests #1708005
Device tests ❌ failed 3 of 105 units maui-pr-devicetests #1708009
🧪 UI tests — Shell1, Shell2, TitleView, Window on Windows

✅ maui-pr-uitests #1708005 passed.

GPT-6.2 Sol: Run Windows UI tests for Shell flyout clipping and custom TitleBar rendering and transitions.
MAI Code 2: Windows-only Shell flyout and custom TitleBar clipping fix; runs Shell and Window UI tests on Windows.

🧪 Ran — 4 categories on Windows

Platform Categories
Windows Shell1, Shell2, TitleView, 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 Shell1 ✅ succeeded
WinUI UITests Controls Shell2 ✅ succeeded
WinUI UITests Controls TitleView ✅ succeeded
WinUI UITests Controls Window ✅ succeeded
🧪 Device tests — Controls.Shell, Controls.Window, Core.Window on Windows

❌ maui-pr-devicetests #1708009 failed — 1 test failed on Unknown. See Failed tests below.

GPT-6.2 Sol: Run Windows Shell regressions and Window tests for custom TitleBar layout and page swaps.
MAI Code 2: Windows-only Shell/TitleBar behavior change; runs Shell and window device tests on Windows.

🧪 Ran — 3 categories on Windows

Platform Categories
Windows Controls.Shell, Controls.Window, Core.Window
📊 Results — failed: 2 passed, 2 failed of 4 jobs

❌ Failed tests (1)

Test Failed on Error
ShellTests.[Shell] Default title bar template paints a single background layer Unknown Assert.Null() Failure: Value is not null

🔗 All test results · Build logs

Job Result
net11.0 direct device tests Windows controls packaged ❌ failed
net11.0 direct device tests Windows controls unpackaged ❌ failed
net11.0 direct device tests Windows core packaged ✅ succeeded
net11.0 direct device tests Windows core unpackaged ✅ 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, FlyoutPage, 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, 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 — 102 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.FlyoutPage, 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.FlyoutView, 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, TitleView, Window Shell1, Shell2, Window

GPT-6.2 Sol — Run Windows UI tests for Shell flyout clipping and custom TitleBar rendering and transitions.

  • RootNavigationView: Shell flyout clipping and restoration.
  • TitleBar.cs: TitleView background rendering.
  • WindowRootView: Window title-bar sizing and content swaps.
  • No other platforms: all behavior changes are Windows-only.

MAI Code 2 — Windows-only Shell flyout and custom TitleBar clipping fix; runs Shell and Window UI tests on Windows.

  • RootNavigationView and WindowRootView are Windows-specific and change how the Shell flyout is clipped beneath a custom title bar, so Windows Shell coverage is required.
  • TitleBar.cs suppresses the duplicate inner-grid background binding only on Windows; Windows Window coverage checks title-bar/window integration.
  • Android, iOS, and MacCatalyst are deliberately excluded because all behavior changes are Windows-only or guarded to non-Windows behavior.

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.Window, Core.Window Controls.Shell, Controls.Window, Core.Window

GPT-6.2 Sol — Run Windows Shell regressions and Window tests for custom TitleBar layout and page swaps.

  • ShellTests.Windows.cs: new clipping and single-paint regressions.
  • WindowRootView: Controls.Window title-bar offsets and page swaps; Core.Window native toolbar and back-button behavior.
  • No other platforms or unrelated units: Windows-only change.

MAI Code 2 — Windows-only Shell/TitleBar behavior change; runs Shell and window device tests on Windows.

  • The changed Windows RootNavigationView and Shell device tests target flyout presentation and custom title-bar clipping, requiring Controls.Shell.
  • WindowRootView and TitleBar integration affects MAUI Window title-bar setup, replacement, and background handling, requiring Controls.Window and Core.Window.
  • Other device platforms are excluded because the production and test changes are Windows-specific.

Generated by /review run-tests. A targeted run is a fast signal, not full-suite certification.

This branch was previously deployed

1 inactive (outdated) deployment
copilot-pat-pool — 76cd6101 Deployed Nov 27, 2026 by SuthiYuvaraj via conclusion #3408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-shell Shell Navigation, Routes, Tabs, Flyout community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows s/autopilot-needs-maintainer-decision MAUI Autopilot stopped: a maintainer needs to decide how to continue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants