понедельник, 3 января 2022 г.

FAQ Narrator in WPF

The built-in Narrator in Windows 10 and Windows 11 is launched by the "LeftCtrl + Win + Enter" shortcut.

Links:

Complete guide to Narrator

Accessibility best practices

In the app window, the control that is in focus is voiced. Also, the Windows narrator voices every key pressed.

In Windows 7, only the specified control name is pronounced. 

Narrator is missing out of the box in Windows 7 SP1 without updates and the very first versions of Windows 10.

1. Narrator announces the type of the selected control, followed by it's name. 

The voiced name is set using the AutomationProperties.Name property. 

For example:

    AutomationProperties.Name = "Login"

For custom controls, you need to write the type yourself. Otherwise, "Custom" will be pronounced.

Example:

Create a class

    public class ToggleSwitchControlAutomationPeer : UserControlAutomationPeer {

        public ToggleSwitchControlAutomationPeer(ToggleButton owner) :

            base(owner) { }

        protected override string GetLocalizedControlTypeCore() {

            return "Toggle switch";

        }

    }

And in control itself

    protected override AutomationPeer OnCreateAutomationPeer() {

        return new ToggleSwitchControlAutomationPeer(this);

    }


2. Recommendation:

Add the app name to the main window and, if possible, to all windows of the application. 

Otherwise, there will be a faceless "MainWindow" or "Login Window".

For example:

"YourApplication MainWindow" or "BestApp Login Window"


3.

By default, the Windows narrator repeats the name of the control, so you don't need to add it to the designation.


4.

With the PasswordBox control (and some more) in the .Net Framework up to 4.7.1 trouble. There are actually three outputs:

a) Updating .Net Framework.

b) Add our own control in which we use the textbox.

c) We use a textbox with a special font (for a password, but potentially unsafe).

https://github.com/dotnet/docs/blob/main/docs/framework/whats-new/whats-new-in-accessibility.md

In .NET Framework 4.7 and earlier versions, xref:System.Windows.Controls.PasswordBox controls were announced as "no item in view" or had otherwise incorrect behavior

5.

Try to use short, clear phrases. No abbreviations, acronyms, compound words.

Комментариев нет:

Отправить комментарий