In this blog post, I want to discuss how to make status changes on the screen accessible to users with a screen reader. In this case, the user started a process and as time passed, the process when through a number of states. When the state changes the narrator should announce that to the user.
The first solution I found is setting the
AutomationProperties.ItemStatus. Unfortunately, the element that had focus was removed from the screen in processing steps. In my next blog post, I describe how to announce a status change where you have the focus on the element that changes. More on using the ItemStatus can be found here: narrator-announcing-an-items-status
A second-way of announcing changes on the screen can be achieved with Live Regions. The LiveRegionChanged event is introduced with .Net Framework 4.7.1 (.Net Framework 4.7.1 accessibility and WPF improvements). Live Regions enables a screen reader to announce important changes to the user that are not on currently focused elements.
The AutomationProperties.LiveSetting indicates how aggressive the messages should be read when the
LiveRegionChanged is triggered. LiveRegionChanged can have 3 values:
The following code shows the Textbox and how to trigger the event:
<TextBlock Name="MyTextBlock" AutomationProperties.LiveSetting="Assertive">announcement</TextBlock>
The code to trigger the status change:
var peer = FrameworkElementAutomationPeer.FromElement(MyTextBlock); peer.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);
When you have triggered the LiveRegionChanged event, the announcement will be given.
Making announcements of status changes in WPF is quite easy using the LiveRegionChanged event. Hopefully, this will help some users to get more out of the UI.