nvda
4519b893 - Add a native selection mode to Gecko virtualBuffers (#15830)

Commit
2 years ago
Add a native selection mode to Gecko virtualBuffers (#15830) Summary of the issue: NVDA allows the user to select text in browse mode. In web browsers where NVDA uses a virtualBuffer to make the content accessible, the selected text is only a plain text representation, and thus copying this text to another application such as MS Word looses all rich formatting. It is also impossible for the user to perform a web page specific action on the selected text, as the web page / application is unaware of NVDA's selection. E.g. Hypothesis's annotation and highlighting features. Description of user facing changes A new Native Selection mode (toggled by NVDA+shift+f10) is now available in NVDA's browse mode for Mozilla Firefox. When turned on, selecting text in browse mode will also manipulate Firefox's own native selection. And copying text with control+c will pass straight through to Firefox, thus copying the rich content, rather than NvDA's plain text representation. Description of development approach Added an updateAppSelection method to the Gecko virtualBuffer Python class, which updates the native selection to mirror NVDA's current browse mode selection, by using the new IAccessibleTextSelectionContainer interface in IAccessible2. This change also required the following: The gecko virtualBuffer backend exposes needed attributes such as IAccessible2 uniqueID on all text runs, so it can be later used to update the native selection via IAccessibleTextSelectionContainer. The base virtualBuffer storage generated XML also includes offsetFromStartOfNode and offsetFromEndOfNode on text tags, so that it is clear how far in the range starts from the real start and end of the text node. XMLTextParser in NvDA now maintains a controlField stack and controlEnd fields now include a reference to the same attribs dictionary that was used on the controlStart. This is so we have all the information about a field by only looking at its controlEnd. Such as when traversing through fields backwards. The Gecko virtualBuffer textInfo's updateSelection method calls updateAppSelection if native selection mode is toggled on.
Parents
Loading