Wrong reading order in Narrator

半腔热情 提交于 2019-12-12 01:18:29

问题


I've got a problem with Microsoft Narrator.

I've got a WPF fragment like this:

<Window
    x:Class="InlineEditbox.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Narrator test" SizeToContent="WidthAndHeight">
    <TextBlock>
        <Run xml:space="preserve">I want to pay </Run>
        <InlineUIContainer>
            <TextBox Width="70" HorizontalContentAlignment="Right">0</TextBox>
        </InlineUIContainer>
        <Run xml:space="preserve"> % more</Run>
    </TextBlock>
</Window>

The text is displayed correctly; however the Narrator reads it this way: "I want to pay percent more, zero" instead of the expected "I want to pay 0 percent more".

Am I doing something wrong? The Narrator could have read the whole text just consequently. Is there a way to work around the problem without the need to change the actual text?


回答1:


Answer from WPF team member:

WPF supports a text control that can have child controls intermixed with its text. The UI Automation tree does not. There is no way describe to automation clients where the child edit control lives within the parent's text. WPF cannot easily fix this - it's a limitation of the automation architecture.

To workaround, one can put the text into separate controls to describe the order in a way that translates to automation:

<TextBlock>I want to pay</TextBlock>
<TextBox> 0 </TextBox>
<TextBlock>% more</TextBlock>

Thx, Rob Relyea

WPF Team




回答2:


Don't use narrator, it's an extremely basic screen reading program and is not generally used by people who need to use a screen reader on a daily basis. See the following question for reccomendations on screen readers to use. Which screen reader would be best to test site accessibility and how to configure that?



来源:https://stackoverflow.com/questions/3201842/wrong-reading-order-in-narrator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!