react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

useInteractionModality detects JAWS and NVDA as mouse in Chromium

Open jesusgalhub opened this issue 4 months ago โ€ข 7 comments

Provide a general summary of the issue here

Scenario: useInteractionModality reports "mouse" when screen reader user interacts GIVEN a user has started their screenreader (JAWS or NVDA) and a chromium browser (Chrome) WHEN the user interacts with the page clicking a button THEN the hook useInteractionModality reports the modality as "mouse"

๐Ÿค” Expected Behavior?

JAWS/NVDA + Chromium interactions are detected as virtual

๐Ÿ˜ฏ Current Behavior

JAWS/NVDA + Chromium interactions are detected as mouse

๐Ÿ’ Possible Solution

We created a very simple 'codepen' to log the event information for every browser and screen reader, to check if there is any difference in terms of the received information. https://es-d-95332884020260709-019f3c39-f927-7d3c-823e-4328eff26b40.codepen.dev/

We detected that the combination JAWS/NVDA + Chrome throws a clickevent and a pointerdown event after interacting with a button by pressing Enter. In addition, we receive pointerType as mouse.

JAWS/NVDA + Firefox and VoiceOver does not trigger a pointerdown event and the pointerType comes as an empty string, so we can detect the device is assistive technology.

We need another type of check for failing combinations to evaluate them as virtual interactions.


Test scenario

1- Navigate to https://codepen.io/editor/jesusgonzaleza/pen/019f3c39-f927-7d3c-823e-4328eff26b40 2- Start your screen reader 3- Interact with the "Simulate click" button 4- Check the reported data from the event

JAWS + Chrome

Insights: a pointerdown event is triggered and pointerType is mouse Image

JAWS + Firefox

Insights: it works correctly. a pointerdown event is not triggered and pointerType is an empty string

Image

VoiceOver + Firefox

Insights: it works correctly. a pointerdown event is not triggered and pointerType is an empty string

Image

VoiceOver + Chrome

Insights: it works correctly. a pointerdown event is not triggered and pointerType is an empty string

Image

๐Ÿ”ฆ Context

We detect if a user is a screen reader user in a SPA. In that case, we focus the title of the page in certain navigations so they are aware of changes. We use useInteractionModality from @react-aria/interactions for some other component related complex accessibility logics.

๐Ÿ–ฅ๏ธ Steps to Reproduce

1- Start JAWS 2- Open Chrome 3- Interact with any button using the screen reader 4- Modality is reported as mouse

Version

3.28.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Windows

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

jesusgalhub avatar Jul 07 '26 12:07 jesusgalhub

Verified your findings in NVDA and JAWS locally. React (who we borrowed this logic from in the first place) used to check the coordinate of the click but seems like this virtual click detection doesn't exist at all now. We'll have to do some testing to see if there is any additional information that would distinguish JAW/NVDA + Chrome presses from standard ones

LFDanLu avatar Jul 08 '26 18:07 LFDanLu

@LFDanLu I've commented in the PR. I believe the solution may not be sufficient for this use case

jesusgalhub avatar Jul 10 '26 08:07 jesusgalhub

Yeah, this will be a tricky one to solve, there very well may not be enough information from the click/pointer events to sufficiently distinguish these screen reader clicks from mouse clicks.

LFDanLu avatar Jul 13 '26 18:07 LFDanLu

@LFDanLu Is this something we can report to chromium team?

jesusgalhub avatar Jul 14 '26 11:07 jesusgalhub

yep, definitely can, probably in the same vein as https://issuetracker.google.com/issues/40805554 which we reported for Talkback. I need to find some time to update that ticket (hopefully soon), and can see about reporting something similar for this. That being said, it may take quite some time for it to get fixed, so it would be good to figure out some kind of workaround for the short term.

LFDanLu avatar Jul 14 '26 16:07 LFDanLu

I created this issue. Feel free to comment and add any information https://issuetracker.google.com/issues/534943063

jesusgalhub avatar Jul 15 '26 06:07 jesusgalhub

I measured this on Windows 11 (26H2, build 26300) with Chrome 155.0.8059.40 and NVDA 2026.2, after seeing #10316 was closed. I'm posting the data because it may explain why no event-based check has worked.

NVDA doesn't go through Chrome's accessibility action here. It simulates a real mouse click. I pressed Enter in browse mode on a <button> three times over two runs. On the second run I also logged pointer movement, and on both of its presses:

  1. The mouse pointer jumped to the centre of the button (clientX/Y 173.67, 357.5 for a button whose centre is 174, 357), about 1 ms before pointerdown.
  2. pointerdown and pointerup fired less than 1 ms apart (0.8 ms and 0.7 ms; on the first run's press they landed in the same millisecond).
  3. About 5 ms after pointerup, the pointer jumped back to where it had been (within half a pixel).
  4. No keydown or keyup for Enter reached the page, in either run.

Apart from that, the events matched a real mouse click field for field:

Hardware mouse (2 clicks) NVDA Enter (3 presses, 2 runs)
pointerdown.pointerType mouse mouse
pointerdown.width / height 1 / 1 1 / 1
pointerdown.pressure 0.5 0.5
mousedown.detail 1 1
click.detail 1 1
mousedown.sourceCapabilities {firesTouchEvents: false} {firesTouchEvents: false}
pointerdown to pointerup 87 ms, 120 ms under 1 ms (all three)

For contrast, Chrome's own accessibility action path does look different. Triggering the same button through UI Automation's InvokePattern.Invoke() gave focus before pointerdown, mousedown.detail === 0, and sourceCapabilities === null on mousedown, mouseup and click, while a mouse click has {firesTouchEvents: false} there. So a sourceCapabilities check would catch assistive technology that uses the accessibility API, but not NVDA's simulated click above. That's why I haven't opened a PR: it wouldn't fix the case in this issue.

If the NVDA case is the main one, it might be worth raising with NV Access as well as Chromium, since Chrome receives what is effectively real mouse input. I can share the test page and the raw event logs if they'd help. I haven't been able to test JAWS.

chanellebingham avatar Oct 20 '26 21:10 chanellebingham