[PR #1915] Accessibility: Finalized Shared UIA Tree Model #24712

Open
opened 2026-01-31 09:04:54 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/1915

State: closed
Merged: Yes


Summary of the Pull Request

The UIA provider classes are now shared properly. They're hooked up to ConHost and Windows Terminal. You should actually have a UIA Tree when you try to use them.

The actual text buffer UIA element is not hooked up for Windows Terminal, however. That'll be a later PR.

References

Extension of #1691
Please read the description in that PR for background information.

Detailed Description of the Pull Request / Additional comments

Changes to the WindowUiaProvider

As mentioned earlier, the WindowUiaProvider is the top-level UIA provider for our projects. To reuse as much code as possible, I created Microsoft::Console::Types::WindowUiaProviderBase. Any existing functions that reference a ScreenInfoUiaProvider were virtual-ized.

In each project, a WindowUiaProvider : WindowUiaProviderBase was created to define those virtual functions. Note that that will be the main difference between ConHost and Windows Terminal moving forward: how many TextBuffers are on the screen.

So, ConHost should be the same as before, with only one ScreenInfoUiaProvider, whereas Windows Terminal needs to (1) update which one is on the screen and (2) may have multiple on the screen.

🚨 Windows Terminal doesn't have the ScreenInfoUiaProvider hooked up yet. We'll have all the XAML elements in the UIA tree. But, since TermControl is a custom XAML Control, I need to hook up the ScreenInfoUiaProvider to it. This work will be done in a new PR and resolve GitHub Issue #1352.

Moved to Microsoft::Console::Types

These files got moved to a shared area so that they can be used by both ConHost and Windows Terminal.
This means that any references to the ServiceLocator had to be removed.

  • IConsoleWindow
    • Windows Terminal: IslandWindow : IConsoleWindow
  • ScreenInfoUiaProvider
    • all references to ServiceLocator and SCREEN_INFORMATION were removed. IRenderData was used to accomplish this. Refer to next section for more details.
  • UiaTextRange
    • all references to ServiceLocator and SCREEN_INFORMATION were removed. IRenderData was used to accomplish this. Refer to next section for more details.
    • since most of the functions were static, that means that an IRenderData had to be added into most of them.

Changes to IRenderData

Since IRenderData is now being used to abstract out ServiceLocator and SCREEN_INFORMATION, I had to add a few functions here:

  • bool IsAreaSelected()
  • void ClearSelection()
  • void SelectNewRegion(...)
  • HRESULT SearchForText(...)

image

SearchForText() is a problem here. The overall new design is great! But Windows Terminal doesn't have a way to search for text in the buffer yet, whereas ConHost does. So I'm punting on this issue for now. It looks nasty, but just look at all the other pretty things here. :)

Miscellaneous Known Issues

  • Issue #1914 - Tracing needs to be reattached
  • Issue #1352 - Windows Terminal: the ScreenInfoUiaProvider needs to be attached to the TermControl.

Things I'll fix in this PR (just need to add commits on top of it):

  • ConHost: the UIA Rects for the caption buttons are missing. Still investigating this issue.
  • I would be VERY surprised if the tests for ConHost pass.

Validation Steps Performed

  • Deployed ConHost from master and ConHost from this branch. Did some quick validation using inspect.exe.
  • Used inspect.exe to see UIA tree in Windows Terminal.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/1915 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request The UIA provider classes are now shared properly. They're hooked up to ConHost and Windows Terminal. You should actually have a UIA Tree when you try to use them. The actual text buffer UIA element is not hooked up for Windows Terminal, however. That'll be a later PR. ## References Extension of #1691 Please read the description in that PR for background information. ## Detailed Description of the Pull Request / Additional comments ### Changes to the WindowUiaProvider As mentioned earlier, the WindowUiaProvider is the top-level UIA provider for our projects. To reuse as much code as possible, I created `Microsoft::Console::Types::WindowUiaProviderBase`. Any existing functions that reference a `ScreenInfoUiaProvider` were virtual-ized. In each project, a `WindowUiaProvider : WindowUiaProviderBase` was created to define those virtual functions. Note that that will be the main difference between ConHost and Windows Terminal moving forward: how many TextBuffers are on the screen. So, ConHost should be the same as before, with only one `ScreenInfoUiaProvider`, whereas Windows Terminal needs to (1) update which one is on the screen and (2) may have multiple on the screen. 🚨 Windows Terminal doesn't have the `ScreenInfoUiaProvider` hooked up yet. We'll have all the XAML elements in the UIA tree. But, since `TermControl` is a custom XAML Control, I need to hook up the `ScreenInfoUiaProvider` to it. This work will be done in a new PR and resolve GitHub Issue #1352. ### Moved to `Microsoft::Console::Types` These files got moved to a shared area so that they can be used by both ConHost and Windows Terminal. This means that any references to the `ServiceLocator` had to be removed. - `IConsoleWindow` - Windows Terminal: `IslandWindow : IConsoleWindow` - `ScreenInfoUiaProvider` - all references to `ServiceLocator` and `SCREEN_INFORMATION` were removed. `IRenderData` was used to accomplish this. Refer to next section for more details. - `UiaTextRange` - all references to `ServiceLocator` and `SCREEN_INFORMATION` were removed. `IRenderData` was used to accomplish this. Refer to next section for more details. - since most of the functions were `static`, that means that an `IRenderData` had to be added into most of them. ### Changes to IRenderData Since `IRenderData` is now being used to abstract out `ServiceLocator` and `SCREEN_INFORMATION`, I had to add a few functions here: - `bool IsAreaSelected()` - `void ClearSelection()` - `void SelectNewRegion(...)` - `HRESULT SearchForText(...)` ![image](https://user-images.githubusercontent.com/11050425/60994413-52c02980-a305-11e9-8912-2027626b7550.png) `SearchForText()` is a problem here. The overall new design is great! But Windows Terminal doesn't have a way to search for text in the buffer yet, whereas ConHost does. So I'm punting on this issue for now. It looks nasty, but just look at all the other pretty things here. :) ### Miscellaneous Known Issues - [ ] Issue #1914 - `Tracing` needs to be reattached - [ ] Issue #1352 - Windows Terminal: the `ScreenInfoUiaProvider` needs to be attached to the `TermControl`. Things I'll fix in this PR (just need to add commits on top of it): - [ ] ConHost: the UIA Rects for the caption buttons are missing. Still investigating this issue. - [x] I would be VERY surprised if the tests for ConHost pass. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Deployed ConHost from master and ConHost from this branch. Did some quick validation using inspect.exe. - Used inspect.exe to see UIA tree in Windows Terminal.
claunia added the pull-request label 2026-01-31 09:04:54 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24712