AccessibleObjectFromPoint returns incorrect accessible for popup menus

RESOLVED FIXED in mozilla25



8 years ago
5 years ago


(Reporter: Jamie, Assigned: surkov)


(Blocks: 1 bug)

Windows 7
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)



(1 attachment)



8 years ago
1. Press alt+f to activate the File menu.
2. Get the location of the "New Tab" menu item.
3. Call AccessibleObjectFromPoint() with a point covered by the location retrieved in step 2.
Expected: The accessible for the "New tab" menu item should be returned.
Actual: Some other accessible outside the menu is returned. (I'm guessing this accessible is overlapped by the menu item.)

The popup window containing the menu (window class name: MozillaDropShadowWindowClass) returns the Firefox top level frame when queried for its client (OBJID_CLIENT). IAccessible::accHitTest on the Firefox top level frame doesn't seem to know about popup menu items.

The MozillaDropShadowWindowClass window should return the popup menu accessible as its client. This menu accessible should answer IAccessible::accHitTest correctly for the menu and its items.

If that isn't an option, you can probably get away with having IAccessible::accHitTest on the top level frame answer for the menu and its items.

Comment 1

8 years ago
Impact: This breaks mouse tracking for Firefox menu items with NVDA.
Related NVDA ticket:


8 years ago
Blocks: 659589

Comment 2

8 years ago
the same issue as in bug 480347. I think it's reasonable to follow Jamie's suggestion in any case so keeping open.

Comment 3

8 years ago
Robert, what's the best way to find popup content from window (nsWindow::ProcessMessage) created for popup?


6 years ago
Flags: needinfo?(roc)
get the window's view's frame.
Flags: needinfo?(roc)

Comment 5

6 years ago
Hi, are there any news on this bug? We are developing a GUI automation tool and are having trouble with menus, particular in Thunderbird.

Comment 6

6 years ago
nominating as q2 target
Blocks: 855324

Comment 7

6 years ago
Robert, one more question please. We use nsLayoutUtils::GetFrameForPoint on document root frame (﷒0﷓) but it seems doesn't take into account any popups shown above the document. How can I detect that the given point points to an element inside popup (originally the point is in screen coordinates)?


6 years ago
Flags: needinfo?(roc)
Use nsLayoutUtils::GetPopupFrameForEventCoordinates(rootPresContext, aEvent). You can look at how PresShell::HandleEvent does this.
Flags: needinfo?(roc)

Comment 9

6 years ago
Created attachment 761495 [details] [diff] [review]
Assignee: nobody → surkov.alexander
Attachment #761495 - Flags: superreview?(roc)
Attachment #761495 - Flags: review?(trev.saunders)
Attachment #761495 - Flags: superreview?(roc) → superreview+
Comment on attachment 761495 [details] [diff] [review]

>     void* uniqueID = reinterpret_cast<void*>(-aVarChild.lVal);
>     // Document.
>     if (IsDoc())
>-      return AsDoc()->GetAccessibleByUniqueIDInSubtree(uniqueID);
>+      return Document()->GetAccessibleByUniqueIDInSubtree(uniqueID);

what is reason for change?

>+#define NS_LOG_WMGETOBJECT(aWnd, aHwnd, aAcc)                                  \
>+  PR_LOG(gWindowsLog, PR_LOG_ALWAYS,                                           \
>+         ("Get the window:\n  {\n     HWND: %d, parent HWND: %d, wndobj: %p,\n",\
>+           aHwnd, ::GetParent(aHwnd), aWnd));                                  \
>+  PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("     acc: %p", aAcc));                  \
>+  if (aAcc) {                                                                  \
>     nsAutoString name;                                                         \
>-    acc->GetName(name);                                                        \
>+    aAcc->GetName(name);                                                       \

use Name()?

> {
>+  nsView* view = nsView::GetViewFor(this);
>+  if (view) {
>+    nsIFrame* frame = view->GetFrame();
>+    if (frame && nsLayoutUtils::IsPopup(frame)) {
>+      nsCOMPtr<nsIAccessibilityService> accService =
>+        services::GetAccessibilityService();
>+      if (accService) {
>+        a11y::DocAccessible* docAcc =
>+          GetAccService()->GetDocAccessible(frame->PresContext()->PresShell());
>+        if (docAcc) {
>+          NS_LOG_WMGETOBJECT(this, mWnd,
>+                             docAcc->GetAccessible(frame->GetContent()));
>+          return docAcc->GetAccessible(frame->GetContent());

roc I'm assuming this stuff seems reasonable to you.  I'd worry a little this might slow down the no a11y case some, but but what becomes GetRootAccessible() has already been pretty slow and could be easily speed up if someone cared I suspect so I'm not really concerned.
Attachment #761495 - Flags: review?(trev.saunders) → review+
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25


5 years ago
Depends on: 891338
You need to log in before you can comment on or make changes to this bug.