Bug 485524

Summary: MenuStrip: menu missing "selected" and "focused" states
Product: [Mono] UI Automation Reporter: Ray Wang <rawang>
Component: Winforms - ATKAssignee: Andres Aragoneses <aaragoneses>
Status: VERIFIED FIXED QA Contact: E-mail List <mono-a11y-qa>
Severity: Normal    
Priority: P2 - High CC: cachen
Version: Unspecified   
Target Milestone: Release 1.1   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Bug Depends on:    
Bug Blocks: 500811    

Description Ray Wang 2009-03-16 09:22:31 UTC
PROBLEM STATEMENT:
when you are clicking a "File" menu in MenuStrip or MainMenu sample, the "File" menu should obtain "focused" and "selected" states. since it is very focused and selected. 

REPRODUCE:
1. start uia2atk/test/samples/menustrip.py or mainmenu.py
2. start accerciser
3. navigate to one of the menus from left side
4. click "interface viewer" and "Accessible"
5. click one of the menus (e.g. File or Edit menu)
6. look at the states of the menu

RESULTS:
there are no "focused" and "selected" states poped up

EXPECTED RESULTS:
the menu should has "focused" and "selected" states

COMMENT:
The menu's situation here is NOT similar to the menu in combo box, in that situation, the menu doesn't have "selected" state
Comment 1 calen chen 2009-03-24 07:04:35 UTC
ADD COMMENTS:

ToolStripDropDownButton, ToolStripSplitButton also have this issue. the bug not only occurred in doing *click in accerciser but also occurred in mouse click Menu to expand MenuItems, then move mouse cursor on MenuItems to navigate that there are no "focused" and "selected" states appeared.

I think bug487654 is duplicate to this bug.

many test depend on it so I change the priority to P2.
Comment 2 Brian Merrell 2009-04-14 17:55:19 UTC
In response to Comment #1, Bug 487654 is not a duplicate of this bug because it refers to menu items while this bug refers to menus.
Comment 3 Brian Merrell 2009-04-14 17:57:56 UTC
The menu doesn't necessarily have to be clicked to reproduce this bug.  For example, using menustrip.py you can click Alt+E to open the "Edit" menu and then press escape.  You will then notice that the "Edit" menu is highlighted, but doesn't have the 'selected' and 'focused' states.  I am updating the bug summary to be more general.
Comment 4 Brad Taylor 2009-04-14 19:06:51 UTC
Someone needs to look at this, but it sounds like the same old "toolstrips can't receive focus" issue.
Comment 5 Andres Aragoneses 2009-05-07 19:07:59 UTC
I'm very close to fixing this, but today my last working patch arised:

- A mono bug (NRE in ToolStripItem.Select() ):

[Warn  14:50:16.831] Obsolete non-lazy-loading GetAdapterForProvider method called.
System.NullReferenceException: Object reference not set to an instance of an object
  at System.Windows.Forms.ToolStripItem.Select () [0x00000] 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.ToolStripItem:Select ()
  at Mono.UIAutomation.Winforms.Behaviors.ToolStripItem.InvokeProviderBehavior.PerformClick () [0x0008f] in /home/knocte/Documents/iDocs/Proyectos/mono/a11y/uia2atkFOCUSABLE/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripItem/InvokeProviderBehavior.cs:115 
System.NullReferenceException: Object reference not set to an instance of an object
  at System.Windows.Forms.ToolStripItem.Select () [0x00000] 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.ToolStripItem:Select ()
  at Mono.UIAutomation.Winforms.Behaviors.ToolStripItem.InvokeProviderBehavior.PerformClick () [0x0008f] in /home/knocte/Documents/iDocs/Proyectos/mono/a11y/uia2atkFOCUSABLE/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripItem/InvokeProviderBehavior.cs:115 


- Two regressions (one may be valid, as we're changing behaviour):

5) UiaAtkBridgeTest.BridgeTests.ParentMenu :    .. Superfluous states: Selected,
  Expected: True
  But was:  False

at UiaAtkBridgeTest.AtkTester.States (Atk.Object accessible, Atk.StateType[] expected) [0x00173] in /home/knocte/Documents/iDocs/Proyectos/mono/a11y/uia2atkFOCUSABLE/UiaAtkBridge/Test/AtkTest/AtkTester.cs:1950
at UiaAtkBridgeTest.AtkTests.ParentMenu () [0x000c0] in /home/knocte/Documents/iDocs/Proyectos/mono/a11y/uia2atkFOCUSABLE/UiaAtkBridge/Test/AtkTest/AtkTests.cs:731
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00057] in /home/knocte/Documents/iDocs/Proyectos/mono/branch/mono-2-4/mcs/class/corlib/System.Reflection/MonoMethod.cs:159

10) UiaAtkBridgeTest.BridgeTests.ToolStripDropDownButton_Bug457990 :    .. Superfluous states: Focused,Selected,
  Expected: True
  But was:  False

at UiaAtkBridgeTest.AtkTester.States (Atk.Object accessible, Atk.StateType[] expected) [0x00173] in /home/knocte/Documents/iDocs/Proyectos/mono/a11y/uia2atkFOCUSABLE/UiaAtkBridge/Test/AtkTest/AtkTester.cs:1950
at UiaAtkBridgeTest.BridgeTests.ToolStripDropDownButton_Bug457990 () [0x0004a] in /home/knocte/Documents/iDocs/Proyectos/mono/a11y/uia2atkFOCUSABLE/UiaAtkBridge/Test/UiaAtkBridgeTest/BridgeTests.cs:807
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00057] in /home/knocte/Documents/iDocs/Proyectos/mono/branch/mono-2-4/mcs/class/corlib/System.Reflection/MonoMethod.cs:159


I have also seen this regression but I guess it's not related to my patch:


9) UiaAtkBridgeTest.BridgeTests.ToolBarDropDownButton :   Atk.Role, we got Filler
  Expected: PushButton
  But was:  Filler

at UiaAtkBridgeTest.AtkTester.PropertyRole (BasicWidgetType type, Atk.Object accessible) [0x00008] in /home/knocte/Documents/iDocs/Proyectos/mono/a11y/uia2atkFOCUSABLE/UiaAtkBridge/Test/AtkTest/AtkTester.cs:953
at UiaAtkBridgeTest.BridgeTests.ToolBarDropDownButton () [0x00012] in /home/knocte/Documents/iDocs/Proyectos/mono/a11y/uia2atkFOCUSABLE/UiaAtkBridge/Test/UiaAtkBridgeTest/BridgeTests.cs:1092
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00057] in /home/knocte/Documents/iDocs/Proyectos/mono/branch/mono-2-4/mcs/class/corlib/System.Reflection/MonoMethod.cs:159
Comment 6 Andres Aragoneses 2009-05-11 20:53:38 UTC
Fixed in r133927.
Comment 7 calen chen 2009-05-12 03:48:46 UTC
Hi Andres,  this fix doesn't work for mainmenu.py, please take a look, thanks a lot!

reopen in rpm version:
uiaatkbridge-133942-660
uiautomationwinforms-133940-665
Comment 8 Sanford Armstrong 2009-05-12 04:39:51 UTC
I really think we should be filing MainMenu/MenuItem/etc bugs separately from MenuStrip/ToolStripMenuItem/etc bugs.  For one thing, they represent separate tasks for the developers, and also we might want to prioritize them differently since MainMenu/MenuItem/etc is obsolete.  Maybe I should send an email about this to the list.
Comment 9 Ray Wang 2009-05-12 09:27:51 UTC
(In reply to comment #8)
> I really think we should be filing MainMenu/MenuItem/etc bugs separately from
> MenuStrip/ToolStripMenuItem/etc bugs.  For one thing, they represent separate
> tasks for the developers, and also we might want to prioritize them differently
> since MainMenu/MenuItem/etc is obsolete.  Maybe I should send an email about
> this to the list.

Yes, I agree
Comment 10 Andres Aragoneses 2009-05-12 13:06:36 UTC
Yeah, besides, this way we consider different priorities for bugs, as the deprecated widgets are not so important. Closing then, please open a new bug for MainMenu.
Comment 11 Feng Xia Mu 2009-06-03 03:35:49 UTC
verify in 
mono-core-135156-1127.src.rpm
mono-uia-132785-276.src.rpm
uiaatkbridge-134036-662.src.rpm
uiautomationwinforms-134512-668.src.rpm
Revision: 135266