-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Place the TabPanel as a child of the TabItem #13964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Place the TabPanel as a child of the TabItem #13964
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR restructures the accessibility hierarchy for TabControl to place TabPanel as a child of TabItem instead of a sibling, improving compliance with UIA best practices and enhancing screen reader experience.
Key Changes
- Moved TabPage Panel from being a direct child of TabControl to being a FirstChild of the selected TabItem
- Updated navigation logic to properly handle parent-child relationships between TabItems and their panels
- Removed outdated sibling navigation logic that treated panels as peers of tab items
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
TabPage.TabPageAccessibleObject.cs | Updated FragmentRoot and FragmentNavigate to establish TabItem as parent, removed sibling navigation logic |
TabPage.TabAccessibleObject.cs | Added FirstChild navigation to expose panel when tab is selected, improved sibling navigation between tabs |
TabControl.TabControlAccessibleObject.cs | Modified FirstChild navigation to return first TabItem instead of selected tab's panel |
private readonly TabPage _owningTabPage; | ||
|
||
public TabPageAccessibleObject(TabPage owningTabPage) : base(owningTabPage) | ||
{ | ||
_owningTabPage = owningTabPage; | ||
} |
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The private field _owningTabPage
duplicates the base class's owner tracking. Consider using the existing TryGetOwnerAs<TabPage>()
method or accessing the owner through the base class instead of storing a separate reference.
Copilot uses AI. Check for mistakes.
return null; | ||
} | ||
|
||
int index = OwningTabControl.TabPages.IndexOf(_owningTabPage); |
Copilot
AI
Oct 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IndexOf
operation is called on every navigation request, which could be inefficient for large tab collections. Consider caching the index or using a more efficient lookup mechanism if navigation frequency is high.
Copilot uses AI. Check for mistakes.
Fixes #10408
Proposed changes
Customer Impact
Regression?
Risk
Screenshots
Before
In the .net project, TreeWalker only obtain the panel. Example project WinFormsApp71.zip
After
In the .net project, TreeWalker can obtain the tabitem

Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow