Open leind375 opened 1 year ago
@Olina-Zhang - Could you please verify when this scenario regressed? Consider using https://learn.microsoft.com/en-us/dotnet/framework/ui-automation/navigate-among-ui-automation-elements-with-treewalker to build a sample
@Tanya-Solyanik I cannot create a sample followed that document provided successfully. And test tabControls in Inspect by Navigation, it has same results in .Net 8.0 and .Net 6.0, TabItems under TabControl are in UIA tree and focused. @leind375 Could you please add more information to demonstrate your issue?
https://github.com/dotnet/winforms/assets/26474449/0f564d0b-41a9-471b-b2c6-690449a861d3
@Olina-Zhang - Could you please verify when this scenario regressed? Consider using https://learn.microsoft.com/en-us/dotnet/framework/ui-automation/navigate-among-ui-automation-elements-with-treewalker to build a sample
I tried to write an sample using Example 2, in the .netFramwork 4.8.1 project, TreeWalker can obtain the tabitem,
but In the .netcore project, TreeWalker obtain the panel.
Sample(the 'UIAutomationClient.dll' and 'UIAutomationTypes.dll' need to be referenced, I am referencing the dlls from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.8.1): WindowsFormsApp3.zip
Thanks @LeafShi1. Verified it is regressed from .Net 6.0, cannot repro in .Net Core 3.1 and .Net 5.0.
.Net 6.0 behavior:
.Net 5.0:
When we use reverse lookup, TreeWalker can obtain the TabItem controls. WinFormsApp71.zip
@leind375, hope this can help you to solve your problem.
This submission has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 14 days.
It will be closed if no further activity occurs within 7 days of this comment.
Adding a comment to keep the defect open. The workaround will help us short term but would still like to see this fixed so we can avoid all the overrides we'll need to implement on future UI.
The workaround above (using GetLastChild() and GetPreviousSibling() also has a defect - GetPreviousSibling is also returning children, not just siblings.
The workaround above (using GetLastChild() and GetPreviousSibling() also has a defect - GetPreviousSibling is also returning children, not just siblings.
We need to modify the code appropriately, e.g. try to use TreeWalker(Condition condition), here is the example code:
@leind375, Will this meet your requirements?
@SimonZhao888 Yes, I can work with this for now. Would still like to see this fixed. Starting to add a lot of hacks in UIA code...
.NET version
.NET 8
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
Yes, I believe it was working in .NET 6.
Issue description
For a WinForms TabControl, the tab page is exposed through UIAutomation but the TabItem controls are missing so there is no way for automations to switch between tabs.
Steps to reproduce
Create a WinForms app. Add a TabControl. By default it will have to pages. Run it. Walk the tree of the application. Tab page is there but no TabItem controls.