[PR #2423] Accessibility: Add BoundingRects to UiaTextRanges #24930

Closed
opened 2026-01-31 09:06:10 +00:00 by claunia · 0 comments
Owner

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

State: closed
Merged: Yes


Summary of the Pull Request

Add the visible rectangle indicators to text ranges. They are now sized appropriately and are located in their correct position. This supports panes, and makes them fairly accessible to use.

References

🚨 Target branch is "Refactor Accessibility Providers" #2414

PR Checklist

Detailed Description of the Pull Request / Additional comments

Thanks to that refactoring, this code is fairly easy to read. There are a few additional refactoring changes throughout this commit.

The core of these changes are in UiaTextRange::_TranslatePointToScreen(). This is where we translate the RECTs to the correct size and position.

  • Size: we needed the current font size. Acquired through ScreenInfoUiaProvider --> TermControl
    • 🚨 NOTE: using IRenderData's is incorrect because Terminal has a fake one there.
  • Position:
    • using ScreenInfoUiaProvider's get_BoundingRectangle to leverage XAML's knowledge of where we are on the screen
      • XAML already uses this function to create a box around the TerminalControl. Let's just borrow that.
    • using TermControl's padding value to adjust even further.

Validation Steps Performed

  1. Create various panes
  2. Make one of the panes have default font size, another with larger, and another with smaller
  3. For each pane, use inspect.exe to test as follows:
    1. get document range
    2. do bounding rects align properly with the text ✔
    3. create a selection
    4. get selection range
    5. do bounding rects align properly with the selection ✔
  4. verify that each pane creates bounding rects of different sizes for the text.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/2423 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request Add the visible rectangle indicators to text ranges. They are now sized appropriately and are located in their correct position. This supports panes, and makes them fairly accessible to use. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References 🚨 Target branch is "Refactor Accessibility Providers" #2414 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #2103 * [x] CLA signed. * [x] ~Tests added/passed~ * [x] ~Requires documentation to be updated~ * [x] I am a core contributor. ## Detailed Description of the Pull Request / Additional comments Thanks to that refactoring, this code is fairly easy to read. There are a few additional refactoring changes throughout this commit. The core of these changes are in `UiaTextRange::_TranslatePointToScreen()`. This is where we translate the RECTs to the correct size and position. - Size: we needed the current font size. Acquired through `ScreenInfoUiaProvider` --> `TermControl` - 🚨 NOTE: using `IRenderData`'s is incorrect because Terminal has a fake one there. - Position: - using `ScreenInfoUiaProvider`'s `get_BoundingRectangle` to leverage XAML's knowledge of where we are on the screen - XAML already uses this function to create a box around the TerminalControl. Let's just borrow that. - using `TermControl`'s `padding` value to adjust even further. ## Validation Steps Performed 1. Create various panes 2. Make one of the panes have default font size, another with larger, and another with smaller 3. For each pane, use inspect.exe to test as follows: 1. get document range 2. do bounding rects align properly with the text ✔ 3. create a selection 4. get selection range 5. do bounding rects align properly with the selection ✔ 4. verify that each pane creates bounding rects of different sizes for the text.
claunia added the pull-request label 2026-01-31 09:06:10 +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#24930