macOS: Making a textview in a scrollview only read the visible text
macOS: Making a textview in a scrollview only read the visible text
- Subject: macOS: Making a textview in a scrollview only read the visible text
- From: Petter Sjölund via Accessibility-dev <email@hidden>
- Date: Tue, 27 Oct 2020 20:43:47 +0100
I have tried for a long time to make this text adventure interpreter work
smoothly with VoiceOver. It has many problems, but one of the most annoying is
that VoiceOver really wants to start reading from the beginning of the text in
the scrollview, which may be thousands of lines back from where we currently
are in the game. I’d like it to always read from the top of the visible text
instead.
Here are some of the things I’ve tried:
- Set the accessibilityElement of the actual NSTextView to false and and use a
custom text view instead that will only return the substring from
accessibilityVisibleCharacterRange of the former. It kind of works, but I still
want the user to be able to navigate the the text in its entirety, scrolling to
the top, searching the full text and so on. This I could not make work. As soon
as I made the full text visible to VoiceOver, it would begin to read it from
the start all over again.
- Set the role of the NSTextView to NSAccessibilityNavigableStaticText instead
of NSAccessibilityTextAreaRole. This actually pretty much works, for some
reason it will now usually read the visible text rather than of all of it. But
editing the text is pretty much broken. (The game text is not and should not be
editable, but the text entry uses the text editing functionality of NSTextView,
and this breaks when the role is set to static.) I tried adding a NSTextField
on top the text view where the player could input text instead of directly
inline into the main text view, but this caused another unending amount of
problems, where VoiceOver would no longer read any text at all and the text
field would no longer accept any input.
- Interrupting VoiceOver before it starts, drowning it out with my own custom
NSAccessibilityAnnouncementRequestedNotification. This will sometimes work, but
usually it will only postpone the inevitable: as soon as there is a quiet
moment, VoiceOver begins reading the entire text from the start again.
I realise this is a vague question. I just want to know if anyone has done
anything similar or can offer any kind of advice. If I should make new attempts
along any of the lines mentioned above, which one do you think is the most
promising?
This is what the application looks like:
https://github.com/angstsmurf/spatterlight/blob/master/README.md
It basically works like the Terminal application (which tends to have the same
problems). The user enters commands at the bottom at the ”>" prompt.
If anyone wants to try it out, it can be downloaded here (along with its source
code): https://github.com/angstsmurf/spatterlight/releases
A sample game is here: https://github.com/i7/counterfeit-monkey/releases
Regards,
Petter Sjölund
_______________________________________________
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