When we hit ENTER key to check/uncheck the checkbox present under 'ToolstripMenuItem1' dropdown is getting closed and keyboard focus loss is observed: A11y_.NET CoreWinforms_StripControls_Toolstripwithmenuitem_Keyboard
.NET version
dotnet-sdk-9.0.100-preview.5.24258.1
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No response
Issue description
GitHub Tags:
#A11yMAS; #A11yTCS; #A11ySev2; #BM_.NET Core[Winforms]_Win32_May2024; #.NETCore; #WCAG2.4.3; #DesktopApp; #Win11; #FTP; #Keyboard;
Environment Details:
App name: .NET Core Winforms Window Version: Win 11 OS Build: 22621.3085
Repro Steps:
- Launch the "Accessibility core app".
- Main Form screen would appear.
- TAB to "MenuToolbars_Controls:Testing the controls under Menu Toolbars Tab" and hit ENTER key.
- TAB to StripControls button and hit ENTER key.
- TAB to Toolstripwithmenuitem1 and hit ENTER key.
- Try to check/ uncheck the checkbox using ENTER key and observe the issue.
Actual Result:
When we hit ENTER key to check/uncheck the checkbox present under 'ToolstripMenuItem1' dropdown is getting closed and keyboard focus loss is observed.
Expected Result:
When we hit ENTER key to check/uncheck the checkbox present under 'ToolstripMenuItem1' dropdown should not get closed and keyboard focus should remain on the checkbox.
User Impact:
Keyboard users will face difficulty while interacting with the control as its getting closed and focus is moving to other controls.
Attachment
https://github.com/dotnet/winforms/assets/90901519/2ed613c4-ecf8-4f9b-a331-e4b3c5c7d23c
GithubTags:#Rev:yaja;
For DropDownMenu, menu items close the menu by default when clicked and focus moves between controls within the application. This is a common issue in VS and windows application.
@MelonWang1 can you check to see if spacebar works in this case? I think it should. In which case I don't think this bug is valid.
@merriemcgaw In the MenuStrip control, the space bar does not work. In the ToolStrip control, the space bar works. See the video.
https://github.com/dotnet/winforms/assets/94418985/13e6f131-32b9-4f16-9ac6-c733b17c78ae
@Tanya-Solyanik this seems like something that may be worth changing - checked MenuItems maybe should respond to the spacebar key to check/uncheck the menu and enter executes it and closes the menu.
Visual Studio does have this behavior in the Window menu, but it feels off to me (show tabs in Sidebar or something like that). We could take this one to Office Hours.
@SimonZhao888 - I spoke with the SMEs and they love the idea of the space bar working to check and uncheck the menu without making the MenuStrip lose focus. Also, please make sure there is a visible focus indicator on the form after the user hits enter to check it (and close the MenuStrip).
@SimonZhao888 Verified this issue in the latest env, issue still repro. Could you please reactivate this bug or provide the latest env details to reverify this issue. Please find repro attachment for reference.
@PoojaNamde Could you please download latest .NET 9.0 SDK 9.0.100-preview.7.24366.32 from https://github.com/dotnet/sdk/blob/main/documentation/package-table.md to verify? The toolStripMenuItem not support click to checked when set CheckOnClick property to false.
Verified this issue in the latest .NET 9.0 Preview7 SDK build: 9.0.100-preview.7.24367.22, it was fixed: Pressing Space can change check/uncheck state; pressing Enter can change check/uncheck state and close dropdown with keeping focus.
https://github.com/user-attachments/assets/2f26f04c-f69b-4d14-af21-bbf1d1a8be3f
Verified the issue with .NET 9.0.100-preview7.24402.8 test pass build that the issue has been fixed, which have the same results as above.
@Liv-Goh Could you pls share .NET 9.0.100-preview7.24402.8 and latest winform zip file to verify this issue.
@PoojaNamde upload in here.
@MelonWang1 verified this issue in the latest environment provided above. Issue is still able to reproduce. Please find the repro attachment for reference. Please reactivate the bug as it is not fixed.
https://github.com/user-attachments/assets/5a794da6-90d7-4c2c-a3f5-b6f3db158ae1
@PoojaNamde Use the latest environment provided above to verified, the issue was fixed. Please see below video.
https://github.com/user-attachments/assets/5489de46-3e7c-4524-910d-31e43330f3c2
Unfortunately, fixing this broke the Menu Selection, and seems to be the showstopper for .NET Paint to migrate to .NET 9 (see #11909), so we need to address this rather urgently.
I will reverse this PR and see if this resolve his issues. If that does the trick, let's tackle this with a different approach for .NET 10. Currently, Visual Studio shows the same behavior, so, I am not terrible concerned to revert this right now.
@merriemcgaw, @Tanya-Solyanik, @lonitra.
@merriemcgaw - paperwork should be updated unless we have a new fix soon.
#A11yByDesign; #A11YCAIOH; #CEACCApproved; #Closed; #Regressed:08-30-24;
This is Invalid bug as this is a standard behavior on Windows or of menu item checks checkboxes. one Focus loss is observed in sample app and that needs to be fixed in primary application Author.