Skip to content

Accessibility: initial implementation of UIA accessibility on Windows - #406

Open
ethindp wants to merge 11 commits into
texus:1.xfrom
ethindp:feature/uia-accessibility
Open

ethindp wants to merge 11 commits into
texus:1.xfrom
ethindp:feature/uia-accessibility

Conversation

@ethindp

@ethindp ethindp commented Nov 23, 2026

Copy link
Copy Markdown

This is my initial implementation of UIA accessibility for Tgui. So far we have the basic controls working, as well as when UIs are created or destroyed functioning properly, which required some very odd WinEvent hacks to make work.

Along the way, I had to make some other changes (some of which were admittedly me being nitpicky about behavior). If you want me to revert any of this, let me know. Those changes are:

  • On Windows, the caret now moves over characters made of several code points as one character, e.g., a letter with a combining accent or an emoji sequence. This applies to character navigation, Shift+arrow selection, Backspace, Delete and mouse clicks. It uses the ICU that ships with Windows 10, loaded at runtime. Other platforms and older Windows keep moving by code point. I would extend this to other platforms, but that would create a bit of a dependency mess.
  • On Windows, Ctrl+Right moves to the start of the next word, like native controls; Ctrl+Delete deletes up to it. Other platforms keep moving to the end of the word.
  • TextArea treats a long word that word wrap split across lines as one word when moving by words, on all platforms. Before, the wrap point counted as a word boundary.
  • radio buttons in the same container are now a single Tab stop, on all platforms. Before I made this change, each radio button was a separate item in tab order, which felt unnatural and clunky in testing.
  • Tabs and VerticalTabs now have full keyboard support.
  • Sliders also now have full keyboard support. If the direction is inverted, keyboard support follows.
  • TGUI's mainLoop now waits with MsgWaitForMultipleObjectsEx on Windows instead of sleeping, at least for the SFML backend, which was a bit of a performance win. This is done via BackendGui::waitForEvents. All of the other backends already do this. Other platforms still sleep like they did before. I did this so that accessibility messages could be reacted to as quickly as possible to make sure the UI didn't feel overly laggy.

And new APIs/signals for widgets, primarily added for accessibility but any app can take advantage:

  • EditBox: getSelectionStart, getSelectionEnd and getCharacterPosition(index).
  • TextArea: getCharacterPosition(index) and getLineStartIndex(lineIndex).
  • Widget signals: onVisibilityChange, onEnabledChange and onChildrenChange.

I've tested this with example programs and the TGUI examples. Many of the widgets, link label included, still remain inaccessible; I'll tackel these in a follow-up PR once we get this merged.

Many of the hacks I unfortunately had to do were due to constraints with Windows accessibility frameworks. These were the only way I could get the frameworks to behave reliably, since they weren't exactly built for this kind of UI, but can be persuaded if you try hard enough.

@ethindp
ethindp force-pushed the feature/uia-accessibility branch from 71b171c to ed928e2 Compare November 23, 2026 02:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant