Add API to facilitate text selection via ATK/AT-SPI2 across multiple objects at once (similar to what IAccessible2 created)
TL;DR: We need to improve how selection via AtspiText works when that selection spans multiple objects. It turns out Windows / IAccessible2 screen readers had the same problem, and they created new API to solve it.
Use case: Orca should be able to provide quick, easy, and reliable text selection via AtspiText.
Problem: The current AtspiText interface provides
atspi_text_set_selection. This API works on a per-accessible-object basis, which has implications:
- In web content where the selection spans multiple elements, Orca would need to use this API on each and every element in the range to be selected. This can be tedious, but in theory is doable were it not for the next item:
- Not all elements in the selection range are exposed in the accessibility tree. And that can be a good thing (no one likes a ginormous accessibility tree). BUT if Orca doesn't know about a particular object in the selection range, Orca cannot select it via the aforementioned API. Skipping over those excluded-from-the-accessibility-tree elements results in non-contiguous selections. Certain browsers -- and possibly other apps and toolkits -- seem to really not like non-contiguous selections. Their response to this unexpected non-contiguous selection is to unselect things that were previously selected.
What Orca does as a result: When the user is in browse mode and uses Shift + Navigation keys, Orca lets the browser do the selection natively and hopes for the best. Often this is "good enough." But sometimes it fails because the user didn't enable the browser's native caret navigation. Other times the browser's native caret navigation doesn't match Orca's, thus what the user thinks will be selected and what actually gets selected can be different. That's confusing.
Happily, it turns out that Windows screen readers had a similar problem, and recently(ish) API was added to IAccessible2 to solve it. As you'll see there, this API operates on a range consisting of a start object + offset and an end object + offset. This approach should eliminate the non-contiguous selection problem.
Can we add matching API to AtspiText?