Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimePicker has incorrect AccessKey and KeyboardShortcut accessibility properties when Text contains '&' character #9281

Closed
dmitrii-drobotov opened this issue Jun 13, 2023 · 3 comments · Fixed by #9414
Assignees
Labels
good first issue Issue should be easy to implement, good for first-time contributors tenet-accessibility MAS violation, UIA issue; problems with accessibility standards

Comments

@dmitrii-drobotov
Copy link
Contributor

dmitrii-drobotov commented Jun 13, 2023

.NET version

.NET 8

Did it work in .NET Framework?

No

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No

Issue description

Follow-up on https://github.com/dotnet/winforms/pull/9253/files#r1227133642.

When DateTimePicker has text with '&' character before another character, DateTimePickerAccessibleObject interprets it as a mnemonic character — as if it's a shortcut to select it by Alt+mnemonic. Some controls like Label support it by adding an underscore for a mnemonic character and making it a shortcut. But DateTimePicker doesn't seem to support it, '&' is interpreted as a regular character without any special meaning, it doesn't create a shortcut. I didn't find a way to turn '&' into a mnemonic by escaping it with \ or similar, and there is no documentation on Win32 DateTimePicker regarding mnemonic characters.

As a result, Narrator announces it as a shortcut, although it doesn't work, unlike a mnemonic shortcut from Label with "&Date" text:
datetimepicker-shortcut

AccessKey and KeyboardShortcut accessibility properties should be empty instead of "Alt+t":
image

Steps to reproduce

  1. Add a DateTimePicker to form
  2. Set Format as Custom
  3. Add & before any character in CustomFormat property, for example set CustomFormat as 'Date&Time' hh:mm dd/MM

Sample app:
WinFormsApp8.zip

@dmitrii-drobotov dmitrii-drobotov added untriaged The team needs to look at this issue in the next triage tenet-accessibility MAS violation, UIA issue; problems with accessibility standards labels Jun 13, 2023
@merriemcgaw merriemcgaw added this to the Future milestone Jun 21, 2023
@merriemcgaw merriemcgaw removed the untriaged The team needs to look at this issue in the next triage label Jun 21, 2023
@Tanya-Solyanik
Copy link
Member

Tanya-Solyanik commented Jun 21, 2023

Most likely real world DateTimePickers don't have Text property set because this property is hidden from the designer. Thus this seems to be a low pri issue.

@Tanya-Solyanik Tanya-Solyanik modified the milestones: Future, .NET 8.0 Jun 27, 2023
@Tanya-Solyanik Tanya-Solyanik added the good first issue Issue should be easy to implement, good for first-time contributors label Jun 27, 2023
Epica3055 added a commit to Epica3055/winforms that referenced this issue Jul 3, 2023
…sibility properties when Text contains '&' character dotnet#9281
Epica3055 added a commit to Epica3055/winforms that referenced this issue Jul 3, 2023
…sibility properties when Text contains '&' character dotnet#9281
@ghost ghost added the 🚧 work in progress Work that is current in progress label Jul 3, 2023
dreddy-work pushed a commit that referenced this issue Jul 5, 2023
…lity properties when Text contains '&' character (#9414)

* fix DateTimePicker has incorrect AccessKey and KeyboardShortcut accessibility properties when Text contains '&' character #9281

* add comment, remove redundant code

* fix wrong case - Win32
@ghost ghost removed the 🚧 work in progress Work that is current in progress label Jul 5, 2023
@ghost ghost removed this from the .NET 8.0 milestone Jul 5, 2023
@Ashley-Li
Copy link

Verified this issue in the latest .NET 8.0 SDK build: 8.0.100-preview.7.23356.13, it was fixed. Now AccessKey and KeyboardShortcut accessibility properties are empty instead of "Alt+t":
test77
image

@Amy-Li03
Copy link
Contributor

Amy-Li03 commented Jul 31, 2023

Verified this issue on .NET 8.0.100-preview.7.23376.3 test pass build, it was fixed, test result is same as above.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Issue should be easy to implement, good for first-time contributors tenet-accessibility MAS violation, UIA issue; problems with accessibility standards
Projects
None yet
8 participants