Bugzilla – Bug 494917
Menu item can be shown without its parent menu showing
Last modified: 2009-06-08 06:02:50 UTC
PROBLEM STATEMENT Assume there is a "File" menu on a MenuStrip for an application. This "File" menu has a menu child named "New" that contains a menu item named "Document". This is the case with uia2atk/test/samples/menustrip.py. The problem is that the the "Document" menu item can be shown without its parent menu being shown. Simply put, the "Document" menu item will appears in the GUI where it would be if the user navigating to it manually using the mouse or keyboard. The attached screenshot illustrates this. REPRO 1. Run Accerciser and open the "IPython Console" tab 2. Run uia2atk/test/samples/menustrip.py 3. If Bug 494586 is open, click on the "File" menu twice to open and close it. This will prevent the application from crashing in step 5 4. In Accerciser, browse to and select the "File" menu accessible. 5. In Accerciser's IPython console, run the following: acc.querySelection().selectChild(0) This will select the first child of the "File" menu accessible, which is the "Document" menu item. RESULTS The "Document" menu item appears in the GUI where it would be if the user navigating to it manually using the mouse or keyboard. See attached screenshot. EXPECTED RESULTS Gtk does some weird things too when using selectChild to select menus and menu items. But it appears to simply ignore attempts to select a menu item unless its parent menu showing. I like that idea. COMMENTS This is related to Bug 494586, which is about the application crashing if REPRO step 3 is not followed.
Created attachment 285700 [details] Screenshot referenced in PROBLEM STATEMENT and RESULTS.
Hmm.. I just noticed something interested about the Gtk behavior. I said in the original EXPECTED RESULTS that "[Gtk] appears to simply ignore attempts to select a menu item unless its parent menu showing." This may not be true, however. It looks like the menu accessible being selected does at least handle the query, and doesn't ignore it altogether. To illustrate this you can do the following: 1. Open Accerciser and click on the "IPython Console" tab 2. Run uia2atk/test/samples/gtkmenubar.py 3. Browse the gtkmenubar.py application's hierarchy in Accerciser and notice that the "File" menu's 2nd child is an "Open Recent" menu 4. Select the "File" menu in Accerciser 5. Run the following in the IPython Console: acc.querySelection().selectChild() 6. Notice that the label at the bottom of the menubar.py application changes to "You selected: Open Recent" For reference, here is the event handler in the menubar.py app: open_recent_item.connect("activate", self.on_activate)
Hey Brad, from your instructions, I got: "TypeError: wrong number of arguments: expected 2, got 1" after I run "acc.querySelection().selectChild()" I guess you miss a parameter, so I add it as: acc.querySelection().selectChild(1) it returns true, but label is not changed.
This is fixed by the same pending patch as in bug #494586: http://reviews.mono-a11y.org/r/168/
Fixed in UIAutomationWinforms (trunk r133036, 1.0 r133037).
I think this bug report is invalid: 10:37 <@bgmerrell> sandy: i think 494917 is invalid 10:37 <@bgmerrell> sandy: :( i can do the same thing in Gtk 10:37 <@bgmerrell> i'm a dolt 10:38 <@sandy> well, for some of these, we may have to show all parent items in order to perform the action correctly 10:38 <@sandy> (not 100% sure) 10:40 <@bgmerrell> sandy: well, if you take gtkmenubar.py and use accerciser to perform a 'click' action on the "Open Recent" menu, that menu's children will appear and be floating without the parent menu We should probably roll it back, especially if it means fixing Bug 501074.
hi, the bug is deal with as: Menu item won't be shown if its parent menu isn't showing. do as following: 1. Run Accerciser and open the "IPython Console" tab 2. Run uia2atk/test/samples/menustrip.py 3. In Accerciser, browse to and select the "File" menu accessible. 4. In Accerciser's IPython console, run the following: acc.querySelection().selectChild(0) result: the "New" menu and "Document" menu item both won't show. I hope when we do "acc.querySelection().selectChild(0)", the "New" menu and its menu item both will show, but in GTK sample if we do the same action, the query menu and menu item will not showing too, so I think the "result" is acceptable, so close this bug.
close in: mono-core-135601-1177.src.rpm mono-uia-132785-276.src.rpm uiaatkbridge-134036-662.src.rpm uiautomationwinforms-134512-668.src.rpm Revision: 135624