Contextual Menus and Keyboard Access
Contextual Menus and Keyboard Access
- Subject: Contextual Menus and Keyboard Access
- From: Carol Clark <email@hidden>
- Date: Mon, 18 Aug 2008 08:41:18 -0500
I also have not found a way to access contextual menus using full
keyboard access mode, which I often use for standard menus.
Does anyone know of a way to get at contextual menus via the keyboard?
Carol Clark
email@hidden
On Aug 14, 2008, at 7:33 AM, Bill Cheeseman wrote:
Contextual menus in general appear to suffer from a fundamental
"parent-child mismatch" issue. I wonder if I can get some
confirmation of my
analysis before I file a formal bug. The primary problem caused by
this bug,
if that's what it is, is that AppleScript's GUI Scripting cannot
work with
contextual menus.
For a test case, I bring up a contextual menu in a TextEdit window,
then
hover the mouse over one of its menu items. The behavior is
generally the
same in all applications, as far as I can tell.
Apple's Accessibility Inspector shows a complete path between the root
application UI element and the contextual menu item under the mouse.
Accessibility Inspector is a screen reader (that is, it calls the
AXUIElementCopyElementAtPosition function). Sure enough, in my own
code, I
am able to start with the "leaf" contextual menu item element under
the
mouse and obtain successive AXParent elements from there all the way
back to
the root application element.
However, it appears to be impossible to get to the leaf menu item
element
from the other direction, proceeding from the "root" application
element and
proceeding through successive AXChildren elements all the way to the
contextual menu item.
You can see this in my PreFab UI Browser, using UI Browser's Screen
Reader.
UI Browser's Screen Reader wants to display not only the
accessibility path,
but also the AppleScript index number of each UI element in the
path. To do
this, it starts by getting the parent of each element, just as
Accessibility
Inspector does, but then it has to reverse direction and get that
parent's
children to obtain the index of the particular child element within
all of
the parent's child elements. In other words, it has to go both ways,
up and
down the accessibility hierarchy. Unfortunately, the parent of a
contextual
menu apparently has no children, in the eyes of the accessibility
API. You
can't get there from here. This is what I mean by a "parent-child
mismatch."
You can also see this problem using UI Browser's main browser view.
The
TextEdit text entry area has no children, even when UI Browser is
used in
the background (hold down the Command key while clicking UI Browser's
controls to keep it in the background) while the TextEdit contextual
menu is
open.
This is fatal to GUI Scripting, because GUI Scripting traverses the
accessibility hierarchy from the root application element and on
through its
children to the desired element.
Looking at the "Displaying a Contextual Menu" section of Apple's
"Application Menu and Pop-up List Programming Topics for Cocoa"
document, I
see that half a dozen different techniques are recommended for
creating
contextual menus. I guess it's no wonder that Cocoa has difficulty
implementing the accessibility API in the face of all these options.
Am I missing something? If not, what can be done about this problem?
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com
PreFab Software - www.prefabsoftware.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (Accessibility-
email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
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