3
votes

JAWS (the screen reader) is treating the contents of a WPF user control differently than the contents of a window. The first time a user tabs to a focusable element in a user control, JAWS reads the entire contents of the user control instead of only the focused element. On a window, when the user tabs to a control, JAWS only reads the focused control. How can I make the user control behave like the window?

Consider the following XAML (namespaces/designer declarations omitted for brevity):

<Window ... Title="MainWindow">
    <StackPanel>
        <Label>First label</Label>
        <Button>A button</Button>
        <Label>Second label</Label>
        <CheckBox>A checkbox</CheckBox>
    </StackPanel>
</Window>

When the above WPF application is started, JAWS reads "Main Window". If the user presses Tab, the first button is focused and JAWS reads "Tab A Button button to activate press space bar". This is expected.

Now consider the above controls wrapped into a user control:

<UserControl ...>
    <StackPanel>
        <Label>First label</Label>
        <Button>A button</Button>
        <Label>Second label</Label>
        <CheckBox>A checkbox</CheckBox>
    </StackPanel>
</UserControl>

and then the user control is placed on MainWindow to replace the other controls:

<Window ... Title="MainWindow">
    <uc:FirstUserControl/>
</Window>

Now when the app is started, JAWS reads the same thing ("Main Window"), but when the user presses Tab, JAWS reads: "Tab First label Second label A Button to activate press space bar". If the user presses Tab again, the checkbox receives focus but JAWS does not re-read everything - it only reads the checkbox label, as expected. Pressing Tab a third time will cycle back to the button, and this time JAWS only reads the focused button text. It seems to only read the entire contents of the user control the first time a child control receives focus.

How can I make the contents of user controls behave the same as controls on a normal window? (That is, I want JAWS to only read the focused content unless the user tells it to read everything on the page).

1
Is the user control or the stack panel element getting the focus?unobf

1 Answers

0
votes

You can set AutomationProperties.Name=" " on the usercontrol. You can also override OnCreateAutomationPeer method of user control to return null.