Hi Tim,
if you require also editing the document (which I would not attempt implementing before you can get VoiceOver to read the document as Vincenzo proposed), I would recommend to implement, on top of NSAccessibilityNavigableStaticText (which inherits from NSAccessibilityStaticText), at least these:
- make sure accessibility can learn about the position of cursor: NSAccessibility.selectedTextRange() (and/or Ranges()); simple cursor without a selection is represented by a range of length 0
- make sure accessibility can learn that the cursor moved: post NSNotification.Name.NSAccessibilitySelectedTextChanged when that happens
- make sure accessibility can learn that the content has changed (has been edited): post NSNotification.Name.NSAccessibilityValueChanged when that happens – this is crucial for "key echo” during typing
The first two points of the above are valid even when you want a non-editable document with a cursor that can be moved and used to select text, otherwise VoiceOver will not be able to announce cursor position movements and selection changes (speak text over which the cursor/selection has passed).
Also, when you are just beginning the implementation of editable text, I would not bother providing attributes in NSAccessibilityStaticText.accessibilityAttributedString(for: NSRange) at first – just return an attributed string with proper underlying string for the range, and with no attributes. From my experience, adding support for attributes is more time consuming to implement than it might seem at first sight 😊 - e.g. dealing with returning attributes for a range which in general can span multiple attribute runs at arbitrary points is quite prone to subtle errors in index computation during initial implementation. You should then add the attributes later, once you get the basics working, this would enable support for e.g. find next previous bold text, announcement of formatting changes etc.
Finally NSAccessibility.accessibilityRange(for: NSPoint) would enable touch exploration of the editable text with the Trackpad (with Trackpad commander turned on) after interacting with the text 😊
Hope this helps to get you started,
Boris
—
Boris Dušek
A11Y LTD.
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