Closed Bug 1843832 Opened 2 years ago Closed 1 year ago

Firefox reports wrong element when Accesibility tools ask for what element is under the specific point and the element is an anchor

Categories

(Core :: Disability Access APIs, defect)

Firefox 115
Desktop
Windows
defect

Tracking

()

RESOLVED FIXED
120 Branch
Tracking Status
firefox120 --- fixed

People

(Reporter: iopanag, Assigned: Jamie)

Details

(Whiteboard: [ctw-23h2])

Attachments

(2 files)

Attached file UIAFirefox.cpp

Steps to reproduce:

This is an issue when using Firefox on windows and trying to get element details under the mouse cursor via Windows UI Automation which is used for accesibility. If the element is an html anchor and is underlined when hovered, firefox reports that under the cursor is the whole Firefox window instead. Here are some reproductions steps:

It is reprodicable on Firefox 115.0.2 on Windows 11 Preview and Windows 10 Pro 22H2. It is NOT reproducible on Firefox ESR 102.13.0.
I created a simple console program in C++ to make sure it is not an issue with Accessibility Insights. This program reports some element information under the mouse cursor via UIAutomation. I attached the source file. It should compile on VS with no special configuration.

Actual results:

When UIAutomation asks Firefox for the element under specific point and the element is an html anchor that the text underlined, Firefox reports the whole window.

Expected results:

When asked for the element under the specific point and the element is a html anchor, it should report that anchor.

The Bugbug bot thinks this bug should belong to the 'Core::Disability Access APIs' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Disability Access APIs
Product: Firefox → Core

Firefox doesn't support UI Automation natively yet. Something weird is going on with the Windows UI Automation -> IAccessible2 proxy here. AccessibleObjectFromPoint returns the right thing, but whenever there is a link, UIA falls back to the window root. I don't yet know why.

Severity: -- → S3
OS: Unspecified → Windows
Hardware: Unspecified → Desktop
Whiteboard: [ctw-23h2]
Status: UNCONFIRMED → NEW
Ever confirmed: true

I get the same behaviour in Google Chrome, except it falls back to the document, not the window. Edge is different because it has a native UIA implementation.

I did a bit more digging:

  1. This seems to be specific to links.
  2. Both Firefox and Chrome expose text leaf children in links and most other elements. AccessibleObjectAtPoint returns the text leaf, not the link, because the text leaf is the deepest child.
  3. Prior to Firefox 113, IAccessible::accHitTest only ever returned a direct child of the element it was called on. After Firefox 113, it returns the deepest child. This change was made for performance and accuracy reasons. AccessibleObjectFromPoint ends up calling accHitTest all the way down the tree anyway, so we may as well save the caller the trouble and do it in Firefox. Chrome has done this for quite some time now (perhaps always).
  4. For some reason, when we return the text leaf child of a link from IAccessible::accHitTest, UI Automation falls back to the window. I don't understand why. There is no good reason for this behaviour that I can think of. This impacts Chrome as well, except it returns the document instead of the window, probably because the document lives in its own HWND in Chrome.

I think we need to understand what the UIA -> IA2 proxy is trying to do here. It seems to me that this is a bug in that proxy, but even if we have to implement a workaround in Firefox, it would be helpful to know how broad that workaround needs to be.

Flags: needinfo?(iopanag)

Curiously, returning ROLE_SYSTEM_GROUPING instead of ROLE_SYSTEM_LINK for links doesn't fix this, so it's not just the role that's the issue here. I can't figure out what else it could be, though.

Assignee: nobody → jteh

:iopanag, any thoughts on comment 4? There seems to be a bug in the UIA -> IA2 proxy here and it'd be good to understand what it's trying to do. I'm hoping you might be able to ask within Microsoft.

Hello, I am sorry for the long time to reply. Indeed this seems to be the issue you describe since chromium based applications have the same issue. I've notified the related team, but it might not be investigated any time soon, because chromium is already developing to move to UIA implementation which will resolve this issue.

Flags: needinfo?(iopanag)

This is necessary to work around a bug in the Windows UI Automation -> IAccessible2 proxy.
See the code comments for details.

There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:Jamie, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(nlapre)
Flags: needinfo?(jteh)

We're waiting for the resolution of Bug 1852190 to land this.

Flags: needinfo?(nlapre)
Flags: needinfo?(jteh)
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c406ccc1889d Never return the text leaf child of a link when calling IAccessible::accHitTest on an ancestor of the link. r=nlapre
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: