Skip to content

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

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

SuthiYuvaraj wants to merge 3 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.

#pragma warning restore CS0618 // Type or member is obsolete
};

#if !WINDOWS

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.

[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;

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.

[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.

@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Selected Tests

@kubaflo — AI-selected UI tests and device tests (GPT-6.2 Sol + MAI Code 2) for commit 76cd6101.

Result PASSED Platforms Windows Tests 4 UI, 5 device Commit 76cd6101


🧪 Test selection — click to expand
Suite Result Selected Build
UI tests ✅ passed 4 of 77 categories maui-pr-uitests #1702767
Device tests ✅ passed 5 of 105 units maui-pr-devicetests #1702769
🧪 UI tests — FlyoutPage, Shell1, Shell2, Window on Windows

✅ maui-pr-uitests #1702767 passed.

GPT-6.2 Sol: Run Windows Shell, FlyoutPage, and Window UI tests for the custom title-bar rendering and clipping changes.
MAI Code 2: Windows-only Shell flyout and custom TitleBar clipping fix; run Shell and Window UI tests on Windows.

🧪 Ran — 4 categories on Windows

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.

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

This branch was previously deployed

1 inactive 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.

2 participants