Fix TabView tear-out sample: close empty windows and clear stale refs#2159
Open
Fix TabView tear-out sample: close empty windows and clear stale refs#2159
Conversation
…#1474) Refactor the Axe accessibility test infrastructure to use targeted per-page rule exclusions instead of globally disabling 10 rules for all pages. Changes: - AxeHelper: Accept optional per-page rule exclusions parameter. Only 4 framework-level rules (NameIsInformative, NameExcludesControlType, NameExcludesLocalizedControlType, SiblingUniqueAndFocusable) remain globally excluded. Improve error messages with element name, automation ID, and rule ID for easier debugging. - AxeScanAllTests: Add PageRuleExclusions dictionary mapping specific pages (WebView2, Icons, MapControl) to their known rule exclusions. Move WebView2, Icons, MapControl from full exclusion list to per-page rule exclusions so they are now scanned with most rules enabled. - MapControlPage: Add AutomationProperties.Name to PasswordBox and MapControl. Mark decorative Image with AccessibilityView=Raw. - StoragePickersPage: Add AutomationProperties.Name to icon-only button. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…#2078) Fix issues in the TabView windowing sample where empty windows were left open after all tabs were torn out or dropped back into another window, and the tabTearOutWindow field held stale references across multiple tear-out operations. Changes: - Add CloseWindowIfEmpty helper that walks the visual tree from a TabView to find its parent Page and close the containing window when empty. - Close source window in Tabs_TabTearOutRequested when all tabs are torn out to a new window. - Close source window in Tabs_ExternalTornOutTabsDropped when all tabs are dropped into a different window. - Clear tabTearOutWindow after tear-out completes to prevent stale references when multiple tear-outs happen in sequence. - Consolidate empty-window check in Tabs_TabCloseRequested to reuse the same CloseWindowIfEmpty helper. - Remove unused DataIdentifier constant. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Note
This PR was generated with the assistance of GitHub Copilot (AI). All changes should be reviewed carefully.
Fixes #2078
The TabView windowing sample (
TabViewWindowingSamplePage.xaml.cs) has issues where empty windows are left open after tab tear-out/drop-back operations, and stale window references can cause unexpected behavior across multiple tear-out sequences.Root Cause Analysis
Issue #2078 reports three problems:
TabTearOutWindowRequestedfires on mouse-down rather than on drag gesture. This is not fixable in the sample code (framework-level issue).tabTearOutWindowreferences.Changes (1 file)
TabViewWindowingSamplePage.xaml.csCloseWindowIfEmpty(TabView)helperTabs_TabTearOutRequestedTabs_ExternalTornOutTabsDroppedtabTearOutWindowafter tear-out completesTabTearOutWindowRequestedsets the field, but it was never cleared — soTabs_TabTearOutRequestedcould reference a wrong window.Tabs_TabCloseRequestedCloseWindowIfEmptyhelper for consistency.DataIdentifierconstantWhat this does NOT fix
The screen flicker on tab click (issue point #1) is caused by
TabTearOutWindowRequestedfiring on mouse-down rather than on an actual drag gesture. This is a WinUI framework behavior, not a sample code issue. A fix would need to come from the microsoft-ui-xaml repo.How to validate
dotnet build WinUIGallery\WinUIGallery.csproj /p:Platform=x64— 0 errors ✅