ShellZero
ShellZero

Reputation: 4661

How to turn off virtual cursor of JAWS programmatically?

I have some dynamic text "n results found" when you search for something in my application. And I have aria-atomic="true" and aria-live="assertive" on this element as follows:

<p aria-atomic="true" aria-live="assertive">n results found</p>

On Mac's voiceover, the message is uttered out correctly without any issues. But on Windows with JAWS software, the message is not uttered out. I noticed that if I turn off the virtual cursor by using the shortcut "Insert+Z", the aria-live string is uttered out properly.

I don't want the user to hit Insert + Z to make this work. Is there a way to disable the virtual cursor programmatically? Or is there any other way around this issue?

I tried several other combinations such as using role="status", role="alert" with aria-live="polite", aria-atomic="true". All of these work on Mac's voiceover and when the virtual cursor is disable on windows with JAWS.

Upvotes: 1

Views: 812

Answers (2)

ShellZero
ShellZero

Reputation: 4661

Turns out JAWS has some pretty uptight attribute rules for this work. I finally made this working with either of these following attributes:

<p aria-live="assertive">n results found</p>

<p aria-live="polite">n results found</p>

The following combinations did not work with JAWS without turning off the virtual cursor:

1. role="alert" aria-live="assertive"
2. role="alert" aria-live="assertive" aria-atomic="true"
3. aria-live="assertive" aria-atomic="true"
4. role="status" aria-live="assertive" aria-atomic="true"
5. role="status" aria-live="polite"
6. role="status" aria-live="assertive"
7. role="status" aria-live="polite" aria-atomic="true"

I know that role="alert" with aria-live="assertive" is redundant as aria-live="assertive" implicitly adds the role alert when used. But I did try it out as an experiment, hence mentioned it above.

All the above did work fine on Mac's voiceover.

Upvotes: 0

QuentinC
QuentinC

Reputation: 14752

Short answer

The short answer is no, you can't disable virtual cursor from the browser. There are attribute combinations and codes that work better than others regarding live regions. Make a search, you should find them. Many people have already written on the subject.

Make your code standard at most as possible: use ARIA, respect WCAG, etc. rather than using complicated or proprietary solutions. IN the long run, it's much better for most users, and for the maintenance on your own app.

Longer answer

For the sake of pure technical culture, the longer answer is yes, it's possible to run Jaws scripts from an external program. There are two solutions:

  1. Call the API of Jaws FSAPI) directly, by using ActiveX or a COM client. ProgID "freedomsci.JawsApi", methods BOOL RunScript(BSTR) and BOOL RunFunction(BSTR).
  2. Use a specialized library that will make the call to FSAPI for you. I'm the author of a DLL called UniversalSpeech that does exactly that.

However, the problem is that, as far as I know, none of the two are easily usable from a browser. At best they need permission from the user, and generally the warnings shown at permission request will make most users to naturally deny.

It would be very hard to explain why you would need access to that, right? So, of course you are strongly advised to stay out of it

There might be an exception though, where the two above solutions would be possible. If you are running a desktop app inside an embedded browser, such as Elektron, NWJS, ... But even in this later case, I would strongly advise to not do it, unless you have very special and precise needs.

Upvotes: 1

Related Questions