microsoft / microsoft/microsoft-ui-xaml
TabView with CanTearOutTabs: dragging the custom title bar after switching tabs tears out a new window instead of moving the window
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
When `TabView.CanTearOutTabs="True"` is used together with a custom title bar, switching between tabs corrupts the title bar's drag region. After a switch, dragging the **empty area of the custom title bar** (not a tab) no longer moves the window — instead the tear-out logic captures the drag: a new window is torn out and follows the cursor while the **original window stays frozen in place**.
This reproduces in the official **WinUI 3 Gallery → "Complete TabView windowing sample"**.
Repro project: [TabTearRepro.zip](https://github.com/user-attachments/files/28949890/TabTearRepro.zip)
### Why is this important?
This bug puts two of the most fundamental desktop interactions in direct conflict.
### Steps to reproduce the bug
1. Open the **WinUI 3 Gallery** app.
2. Navigate to the **TabView** page.
3. scroll **Complete TabView windowing sample** and click **Click here to launch the sample** (or launch Repro project).
4. switch tab (e.g. Item1).
5. Move the cursor to the **empty area of the title bar**, then drag, trying to move the whole window.
```
Note: the bug is gated on a prior tab switch. If you drag the title bar **without** switching tabs first, it may not reproduce.
```
### Actual behavior
The current selected tab window stays frozen in its original position. A new window is "torn out" and follows the cursor, leaving the original window behind.
### Expected behavior
Dragging the empty title bar area moves the entire window smoothly with the cursor, regardless of any prior tab switching.
### Screenshots
### NuGet package version
Microsoft.WindowsAppSDK 2.2.0
### Windows version
Windows 11 (24H2): Build 26100
### Additional context
_No response_
Contributor guide
Research direction
Start with the WinUI 3 Gallery TabView page and its Complete TabView windowing sample, reproducing the issue by switching tabs before dragging the empty custom title bar area. Trace the sample's title-bar drag and tab tear-out behavior; done means the original window moves normally after switching tabs and no unwanted window is created.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100