microsoft / microsoft/microsoft-ui-xaml

TabView TearOutTabs: The TabTearOutWindowRequested event is raised too often

Open
#10,154 1 comment 4 reactions 0 assignees View on GitHub
area-TabView bug team-Controls
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### Describe the bug

The `TabTearOutWindowRequested` event is raised every time a tab header is left clicked, right clicked and even when the tab close button is right clicked.

As a result I've had to add code in the repro app below that limits the number of new windows created in the `TabTearOutWindowRequested` event handler.

If a tab isn't subsequently then torn out, the new window won't be used and remains hidden. To that end I've also had to add code to close it, allowing the app to shutdown.

Repro project: [TearOutTabs.zip](https://github.com/user-attachments/files/17715458/TearOutTabs.zip)

### Steps to reproduce the bug

.

### Expected behavior

I think that the `TabTearOutWindowRequested` event should only be raised once per tear out sequence, with the new window cached by the tear out code until it's used. Or may be even only raised immediately before a tab is torn out when the tear out process starts.

### Screenshots

_No response_

### NuGet package version

WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002

### Windows version

Windows 11 (22H2): Build 22621

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at the TabView tear-out path associated with TabTearOutWindowRequested and reproduce the behavior using the attached TearOutTabs.zip project. Verify that left clicks, right clicks, and close-button clicks no longer raise the event unnecessarily, and that a tear-out sequence raises it only once before the window is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.