Re: Editable text accessibility - does it exist?
Re: Editable text accessibility - does it exist?
- Subject: Re: Editable text accessibility - does it exist?
- From: James Dempsey <email@hidden>
- Date: Thu, 7 Oct 2010 07:39:58 -0700
On Oct 6, 2010, at 9:03 PM, Scott Kovatch wrote:
> Hello,
>
> I'm looking into providing the equivalent of IAccessibleEditableText for the Cocoa version of the SWT. For those not familiar with IAccessible2, this is a collection of methods for getting text from and sending it to the clipboard using an assistive technology. Basically, something would call into our code and invoke copy, paste, replace text, set attributes, etc. directly, with a string and insertion point or range of text to modify as opposed to invoking cut/copy/paste from the menu or via keyboard shortcut and reading from the clipboard and modifying whatever is currently selected.
>
> The main caller of such an API would most likely be a voice recognition engine that could handle a command like "copy word 2" or "paste at the end of the line", but that seems beyond the capabilities of either Speakable Items or Dragon Dictation. Both of those look like they just send a keystroke to the frontmost application.
>
> I'm not seeing anything in NSAccessibility that would let me accomplish this -- it's more oriented towards reading and writing attributes and invoking direct actions as opposed more complicated things like 'copy characters 3 through 10 to the clipboard, and don't move the selection' -- I guess I'm looking for something like a parameter-izable action, much like accessibilityAttributeValue:forParameter:
The primary purpose of the AX accessibility APIs (for accessibility clients such as VoiceOver) and the NSAccessibility APIs (for applications to handle AX client requests) is to provide an alternate representation of an application's user interface, allowing the AX client to get information and interact with the various UI elements.
Using that alternate representation, accessibility clients can build whatever alternate user experience is required. The rule of thumb is to provide accessibility clients a means for working with the view/interface layer of an application, and not to provide a completely separate avenue to accomplishing tasks. Since the standard interface for copy and paste is typically selecting a menu item or using a key command, you can perform a similar interaction as an AX client.
That said, I think an AX client can be built to do the sorts of functionality you mention using the existing API. For an AXTextArea you can get the range of a particular line, get and set the current selection range and get and set the selected text, which can be used to insert and delete text. From actions like these, you can insert and delete text as you wish from an accessibility client. Any of these activities the move the selection would be visible, and at the end you would restore the selection.
For 'copy characters 3 through 10 to the clipboard, and don't move the selection', you could ask for the parameterized attribute AXRTFForRange, and then put the result onto the clipboard yourself as rich text.
In summary, the focus is to expose the interface elements of an application to assistive applications, to enable alternate means of using the application to be developed, so you can certainly make an application copy and paste through the AX APIs, but doing so through the mechanisms that are in place in the app.
> Having said all of that, I guess I have two questions:
>
> -- Is there a way to interact with the clipboard that doesn't involve invoking a menu item or command key?
> -- Is there any AT on Mac OS X, third party or otherwise, that would use this? I feel like I would be writing a service that no client could talk to.
>
> I think the answer to both is no, but I'm open to suggestions or pointers to something I'm not seeing.
I would also echo the comments of Travis, who mentions scripting.
While AX enables interaction with an application at the view layer (including making changes visible, so sighted users can collaborate with those using assistive technologies), scripting enables interaction with an app at the model layer – and there is a fairly rich scripting dictionary defined for text (including delimiting words/characters/paragraphs, etc). With the various scripting bridges on Mac OS X, you can control scriptable apps in languages other than AppleScript, (Obj-C, python, ruby).
-James
--------------------------------------------------
James Dempsey
AppKit Engineering
Apple
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden