WinForms: A screen reader announces an image as being text

This article is referenced directly by Microsoft Accessibility Insights for Windows. Microsoft Accessibility Insights for Windows can help spotlight many accessibility issues in UI, and guide you to the relevant UI framework-specific code sample to help you resolve the issue. Learn more about Microsoft Accessibility Insights for Windows.

Problem

Visually a control presents only an image, yet when a screen reader encounters it, it announces the control as being text. This experience is misleading to my customers.​

Suggested Fix

A WinForms Label control may be used to present one or both of a text string and an image. By default, the control will get programmatically exposed through the UI Automation (UIA) API as having a ControlType of Text. If the Label does present text, then such a ControlType is appropriate. But if the Label control only presents an image, then a ControlType of text is not the most appropriate ControlType.

In that case, set the control to have an AccessibleRole of Graphic. Its UIA ControlType becomes Image as a result. The AccessibleRole can be set through the Properties pane in Visual Studio, or using the code-behind shown below.

this.myLabel.AccessibleRole = AccessibleRole.Graphic;