|
| 1 | +## Accessibility improvements in Windows Forms controls for .NET 4.8 |
| 2 | + |
| 3 | +### Scope |
| 4 | +Major |
| 5 | + |
| 6 | +### Version Introduced |
| 7 | +4.8 |
| 8 | + |
| 9 | +### Source Analyzer Status |
| 10 | +NotPlanned |
| 11 | + |
| 12 | +### Change Description |
| 13 | +The Windows Forms Framework is continuing to improve how it works with accessibility technologies to better support Windows Forms customers. These include the following changes: |
| 14 | +- Changes to improve display during High Contrast mode. |
| 15 | +- Changes to interaction with Narrator. |
| 16 | +- Changes in the Accessible hierarchy (improving navigation through the UI Automation tree). |
| 17 | + |
| 18 | +- [x] Quirked |
| 19 | +- [ ] Build-time break |
| 20 | + |
| 21 | +### Recommended Action |
| 22 | +__How to opt in or out of these changes__ |
| 23 | + |
| 24 | +In order for the application to benefit from these changes, it must run on the .NET Framework 4.8. The application can opt in into these changes in either of the following ways: |
| 25 | +- It is recompiled to target the .NET Framework 4.8. These accessibility changes are enabled by default on Windows Forms applications that target the .NET Framework 4.8. |
| 26 | +- It targets the .NET Framework 4.7.2 or earlier version and opts out of the legacy accessibility behaviors by adding the following [AppContext switch](https://docs.microsoft.com/dotnet/framework/configure-apps/file-schema/runtime/appcontextswitchoverrides-element) to the `<runtime>` section of the app config file and setting it to `false`, as the following example shows. |
| 27 | + |
| 28 | +```xml |
| 29 | + <?xml version="1.0" encoding="utf-8"?> |
| 30 | + <configuration> |
| 31 | + <startup> |
| 32 | + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/> |
| 33 | + </startup> |
| 34 | + <runtime> |
| 35 | + <!-- AppContextSwitchOverrides value attribute is in the form of 'key1=true|false;key2=true|false --> |
| 36 | + <AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false;Switch.UseLegacyAccessibilityFeatures.2=false;Switch.UseLegacyAccessibilityFeatures.3=false" /> |
| 37 | + </runtime> |
| 38 | + </configuration> |
| 39 | +``` |
| 40 | +Note that to opt in to the accessibility features added in .NET Framework 4.8, you must also opt in to accessibility features of .NET Framework 4.7.1 and 4.7.2 as well. |
| 41 | +Applications that target the .NET Framework 4.8 and want to preserve the legacy accessibility behavior can opt in to the use of legacy accessibility features by explicitly setting this AppContext switch to `true`. |
| 42 | + |
| 43 | +Enabling the keyboard ToolTip invocation support requires adding the `Switch.System.Windows.Forms.UseLegacyToolTipDisplay=false` line to the AppContextSwitchOverrides value: |
| 44 | + |
| 45 | +```xml |
| 46 | +`<AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false;Switch.UseLegacyAccessibilityFeatures.2=false;Switch.UseLegacyAccessibilityFeatures.3=false;Switch.System.Windows.Forms.UseLegacyToolTipDisplay=false" />` |
| 47 | +``` |
| 48 | + |
| 49 | +Note that enabling this feature requires opting in to the aforementioned accessibility features of .NET Framework 4.7.1 - 4.8. Also, if any of the accessibility features are not opted in but the tooltip display feature is opted in, a runtime <xref:System.NotSupportedException> will be thrown on the first access to these features. The exception message indicates that keyboard ToolTips require accessibility improvements of level 3 to be enabled. |
| 50 | + |
| 51 | +__Use of OS-defined colors in High Contrast themes__ |
| 52 | +- Improved high-contrast themes. |
| 53 | + |
| 54 | +__Improved Narrator support__ |
| 55 | +- Narrator now announces the sort direction of the <xref:System.Windows.Forms.DataGridViewColumn> when announcing an accessible name of a <xref:System.Windows.Forms.DataGridViewCell>. |
| 56 | + |
| 57 | +__Improved CheckedListBox Accessibility support__ |
| 58 | +- Improved Narrator support for the <xref:System.Windows.Forms.CheckedListBox> control. When navigating to the <xref:System.Windows.Forms.CheckedListBox> control using the keyboard, Narrator focuses the <xref:System.Windows.Forms.CheckedListBox> item and announces it. |
| 59 | +- An empty CheckedListBox control now has a focus rectangle drawn for a virtual first item when the control becomes focused. |
| 60 | + |
| 61 | +__Improved ComboBox Accessibility support__ |
| 62 | +- Enabled UI Automation support for the <xref:System.Windows.Forms.ComboBox> control, with the ability to use UI Automation notifications and other UI Automation features. |
| 63 | + |
| 64 | +__Improved DataGridView Accessibility support__ |
| 65 | +- Enabled UI Automation support for <xref:System.Windows.Forms.DataGridView> control with ability to use UI Automation notifications and other UI Automation features. |
| 66 | +- The UI Automation element which corresponds to the <xref:System.Windows.Forms.DataGridViewComboBoxEditingControl> or <xref:System.Windows.Forms.DataGridViewTextBoxEditingControl> is now a child of corresponding editing cell. |
| 67 | + |
| 68 | +__Improved LinkLabel Accessibility support__ |
| 69 | +- Improved <xref:System.Windows.Forms.LinkLabel> control accessibility: Narrator announces the disabled state for the link if the corresponding <xref:System.Windows.Forms.LinkLabel> control is disabled. |
| 70 | + |
| 71 | +__Improved ProgressBar Accessibility support__ |
| 72 | +- Enabled UI Automation support for the <xref:System.Windows.Forms.ProgressBar> control with the ability to use UI Automation notifications and other UI Automation features. Developers are now able to use UI Automation notifications which Narrator can announce to indicate progress. |
| 73 | + |
| 74 | +For an overview of UI automation events overview, including UI automation notification events, see the [UI Automation Events Overview](https://docs.microsoft.com/en-us/windows/desktop/WinAuto/uiauto-eventsoverview). |
| 75 | + |
| 76 | +__Improved PropertyGrid Accessibility support__ |
| 77 | +- Enabled UI Automation support for the <xref:System.Windows.Forms.PropertyGrid> control, with the ability to use UI Automation notifications and other UI Automation features. |
| 78 | +- The UI Automation element which corresponds to the currently edited property is now a child of the corresponding property item UI Automation element. |
| 79 | +- The UI Automation property item element is now a child of the corresponding category element if the parent <xref:System.Windows.Forms.PropertyGrid> control is set to category view. |
| 80 | + |
| 81 | +__Improved ToolStrip support__ |
| 82 | +- Enabled UI Automation support for the <xref:System.Windows.Forms.ToolStrip> control, with the ability to use UI Automation notifications and other UI Automation features. |
| 83 | +- Improved navigation through <xref:System.Windows.Forms.ToolStrip> items. |
| 84 | +- In items mode, Narrator focus does not disappear and does not go to hidden items. |
| 85 | + |
| 86 | +__Improved Visual cues__ |
| 87 | +- An empty <xref:System.Windows.Forms.CheckedListBox> control now displays a focus indicator when it receives focus. |
| 88 | + |
| 89 | +Note: UI automation support is enabled for controls in runtime but is not used in design time. |
| 90 | +For an overview of UI automation, see the [UI Automation Overview](https://docs.microsoft.com/dotnet/framework/ui-automation/ui-automation-overview).</p> |
| 91 | + |
| 92 | +__Invoking controls' ToolTips with a keyboard__ |
| 93 | +- Control tooltip can now be invoked by focusing the control with keyboard. This feature needs to be enabled explicitly for the application (see section __"How to opt in or out of these changes"__) |
| 94 | + |
| 95 | +### Affected APIs |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +### Category |
| 100 | +Windows Forms |
| 101 | + |
| 102 | +<!-- |
| 103 | + ### Original Bug |
| 104 | +442899 |
| 105 | +526702 |
| 106 | +533226 |
| 107 | +657355 |
| 108 | +661319 |
| 109 | +642548 |
| 110 | +537224 |
| 111 | +549558 |
| 112 | +581351 |
| 113 | +560840 |
| 114 | +497307 |
| 115 | +548792 |
| 116 | +686499 |
| 117 | +
|
| 118 | +--> |
| 119 | + |
| 120 | +<!-- breaking change id: --> |
| 121 | + |
0 commit comments