Feature Idea: Find/Extract Text Attributes for Accessibility #3015

Closed
opened 2026-01-30 23:10:52 +00:00 by claunia · 8 comments
Owner

Originally created by @carlos-zamora on GitHub (Jul 30, 2019).

Originally assigned to: @carlos-zamora on GitHub.

Description of the new feature/enhancement

ITextRangeProviders can have support for a FindAttribute() function (link). They support a ton of different text attributes.

We definitely can support background/foreground color. This might be a good opportunity to enhance our accessibility as a terminal. But we need to do some research as to how automation clients (i.e.: narrator) make use of this.

This would also expand as we support more text attributes in the future.

Proposed technical implementation details (optional)

This would go in the shared code for UIATextRange and would require some changes to propagate to XamlUiaTextRange in Windows Terminal.

Originally created by @carlos-zamora on GitHub (Jul 30, 2019). Originally assigned to: @carlos-zamora on GitHub. # Description of the new feature/enhancement `ITextRangeProvider`s can have support for a `FindAttribute()` function ([link](https://docs.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextrangeprovider-findattribute)). They support a ton of different [text attributes](https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-textattribute-ids). We definitely can support background/foreground color. This might be a good opportunity to enhance our accessibility as a terminal. But we need to do some research as to how automation clients (i.e.: narrator) make use of this. This would also expand as we support more text attributes in the future. # Proposed technical implementation details (optional) This would go in the shared code for `UIATextRange` and would require some changes to propagate to `XamlUiaTextRange` in Windows Terminal.
Author
Owner

@codeofdusk commented on GitHub (Apr 6, 2020):

Could this be prioritized for 21H1? NVDA definitely can get colours from UIA.

@codeofdusk commented on GitHub (Apr 6, 2020): Could this be prioritized for 21H1? NVDA definitely can get colours from UIA.
Author
Owner

@DHowett-MSFT commented on GitHub (Apr 6, 2020):

I'm averse to scoping additional things into 21H1 while the team is heads-down on Terminal v1. 😄 Sorry.

@DHowett-MSFT commented on GitHub (Apr 6, 2020): I'm averse to scoping additional things into 21H1 while the team is heads-down on Terminal v1. :smile: Sorry.
Author
Owner

@codeofdusk commented on GitHub (Apr 29, 2020):

With the additional three months, could this issue be reconsidered for 21H1 (just exposing colours, not necessarily #3567)? Thanks!

@codeofdusk commented on GitHub (Apr 29, 2020): With the additional three months, could this issue be reconsidered for 21H1 (just exposing colours, not necessarily #3567)? Thanks!
Author
Owner

@codeofdusk commented on GitHub (Sep 22, 2020):

The discussion on #7691 reminded me of this issue. I think it might be worth reconsidering as well to enable support for more text attributes besides links.

It also seems that the console supports bold/italic/underlined text, could these also be mapped onto UIA formatting attributes? (colours would definitely be a good start though!)

If I have spare cycles and want to look into this, where might I start? Where are colours/formatting attributes exposed? Is it just a matter of creating a mapping from conhost attributes to UIA ones?

@codeofdusk commented on GitHub (Sep 22, 2020): The discussion on #7691 reminded me of this issue. I think it might be worth reconsidering as well to enable support for more text attributes besides links. It also seems that the console supports bold/italic/underlined text, could these also be mapped onto UIA formatting attributes? (colours would definitely be a good start though!) If I have spare cycles and want to look into this, where might I start? Where are colours/formatting attributes exposed? Is it just a matter of creating a mapping from conhost attributes to UIA ones?
Author
Owner

@carlos-zamora commented on GitHub (Sep 22, 2020):

The discussion on #7691 reminded me of this issue. I think it might be worth reconsidering as well to enable support for more text attributes besides links.

It also seems that the console supports bold/italic/underlined text, could these also be mapped onto UIA formatting attributes? (colours would definitely be a good start though!)

If I have spare cycles and want to look into this, where might I start? Where are colours/formatting attributes exposed? Is it just a matter of creating a mapping from conhost attributes to UIA ones?

It seems like most of the work would be mapping the TextBuffer attributes to UIA ones.

I took a quick look at #7251 since that adds a new text attribute and uses it. Here's some useful files too:

Most of the work of finding and exposing TextAttributes already seems to be done in TextBuffer.

@carlos-zamora commented on GitHub (Sep 22, 2020): > The discussion on #7691 reminded me of this issue. I think it might be worth reconsidering as well to enable support for more text attributes besides links. > > It also seems that the console supports bold/italic/underlined text, could these also be mapped onto UIA formatting attributes? (colours would definitely be a good start though!) > > If I have spare cycles and want to look into this, where might I start? Where are colours/formatting attributes exposed? Is it just a matter of creating a mapping from conhost attributes to UIA ones? It seems like most of the work would be mapping the TextBuffer attributes to UIA ones. I took a quick look at #7251 since that adds a new text attribute and uses it. Here's some useful files too: - https://github.com/microsoft/terminal/blob/master/src/buffer/out/AttrRow.hpp - https://github.com/microsoft/terminal/blob/master/src/buffer/out/AttrRowIterator.hpp - https://github.com/microsoft/terminal/blob/master/src/buffer/out/TextAttribute.hpp - https://github.com/microsoft/terminal/blob/master/src/buffer/out/TextAttributeRun.hpp - https://github.com/microsoft/terminal/blob/49b9d41caf1ae03180af3744bdb5d910d702fb10/src/buffer/out/textBuffer.cpp#L1199 Most of the work of finding and exposing TextAttributes already seems to be done in TextBuffer.
Author
Owner

@carlos-zamora commented on GitHub (May 26, 2021):

Some text attributes that we can expose:

  • *UIA_FontNameAttributeId 40005: non-localized font name string
  • *UIA_FontSizeAttributeId 40006: point size of the font
  • UIA_FontWeightAttributeId 40007: thickness/boldness of the font
  • UIA_ForegroundColorAttributeId 40008: foreground color of text as COLORREF
  • *UIA_IsActiveAttributeId: indicates whether the control that contains the text range has the keyboard focus or not
  • UIA_IsItalicAttributeId 40014: indicates whether the text is italic or not
  • **UIA_IsReadOnlyAttributeId 40015: indicates whether the text is read-only or can be modified
  • UIA_LinkAttributeId 40035: represents a hyperlink
  • UIA_SelectionActiveEndAttributeId 40037: indicates if we're at the start or end (or neither) of the selected range
  • *UIA_TextFlowDirectionsAttributeId 4028: the direction of text flow
  • *UIA_UnderlineColorAttributeId 40029: the color of the underline text decoration as a COLORREF
  • UIA_UnderlineStyleAttributeId 40030: style of the underline text decoration

*not sure if these are worth adding
**is this even possible for us? Might just be a future consideration.

@carlos-zamora commented on GitHub (May 26, 2021): Some text attributes that we can expose: - *`UIA_FontNameAttributeId 40005`: non-localized font name string - *`UIA_FontSizeAttributeId 40006`: point size of the font - `UIA_FontWeightAttributeId 40007`: thickness/boldness of the font - `UIA_ForegroundColorAttributeId 40008`: foreground color of text as COLORREF - *`UIA_IsActiveAttributeId`: indicates whether the control that contains the text range has the keyboard focus or not - `UIA_IsItalicAttributeId 40014`: indicates whether the text is italic or not - **`UIA_IsReadOnlyAttributeId 40015`: indicates whether the text is read-only or can be modified - `UIA_LinkAttributeId 40035`: represents a hyperlink - `UIA_SelectionActiveEndAttributeId 40037`: indicates if we're at the start or end (or neither) of the selected range - *`UIA_TextFlowDirectionsAttributeId 4028`: the direction of text flow - *`UIA_UnderlineColorAttributeId 40029`: the color of the underline text decoration as a COLORREF - `UIA_UnderlineStyleAttributeId 40030`: style of the underline text decoration *not sure if these are worth adding **is this even possible for us? Might just be a future consideration.
Author
Owner

@codeofdusk commented on GitHub (May 26, 2021):

*UIA_FontNameAttributeId 40005: non-localized font name string
*UIA_FontSizeAttributeId 40006: point size of the font

Are these customizable by the user or can they otherwise differ? If so, please add them. If the terminal always uses the same font and size, no need.

*UIA_IsActiveAttributeId: indicates whether the control that contains the text range has the keyboard focus or not

Probably not super necessary as the console always has keyboard focus?

*UIA_TextFlowDirectionsAttributeId 4028: the direction of text flow

Probably good for i18n.

*UIA_UnderlineColorAttributeId 40029: the color of the underline text decoration as a COLORREF

Please add.

@codeofdusk commented on GitHub (May 26, 2021): > *UIA_FontNameAttributeId 40005: non-localized font name string > *UIA_FontSizeAttributeId 40006: point size of the font Are these customizable by the user or can they otherwise differ? If so, please add them. If the terminal *always* uses the same font and size, no need. > *UIA_IsActiveAttributeId: indicates whether the control that contains the text range has the keyboard focus or not Probably not super necessary as the console always has keyboard focus? > *UIA_TextFlowDirectionsAttributeId 4028: the direction of text flow Probably good for i18n. > *UIA_UnderlineColorAttributeId 40029: the color of the underline text decoration as a COLORREF Please add.
Author
Owner

@ghost commented on GitHub (Jul 14, 2021):

:tada:This issue was addressed in #10336, which has now been successfully released as Windows Terminal Preview v1.10.1933.0.🎉

Handy links:

@ghost commented on GitHub (Jul 14, 2021): :tada:This issue was addressed in #10336, which has now been successfully released as `Windows Terminal Preview v1.10.1933.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.10.1933.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#3015