问题描述
我正在尝试为我的应用程序添加可访问性.我仍然无法弄清楚可访问性在 Spark 组件中究竟是如何工作的.
我在窗口平台上,启用了叙述者功能.我想要做的就是使用不同的名称为三个字段命名以方便访问,以便用户知道该怎么做.我试图只使用声明来定义可访问性属性,但似乎它总是只会说出按钮的一个名称.因此,我采用了另一种方法,并尝试在创建完成后创建可访问性属性.似乎叙述者有时会在开始时选择可访问性的正确名称,然后很快,当我转到按钮时,它会替换所有名称并将其称为搜索按钮".知道为什么吗?!?!我很困惑.任何帮助将不胜感激.
I'm trying to add accessibility to my application. I still can't figure out exactly how accessibility works in spark components.
I'm on window's platform with the narrator function enabled.All I want to do is to name the three fields with a different name for accessibility so the user knows what to do.I tried to just use declaration to define the accessibility properties but it seems like it will always only speak out one name of the button. Thus, I took another approach and tried to create the accessibility properties when it does the creation complete. It seems like the narrator is sometimes picking up the correct name of the accessibility in the beginning, then very soon, when I goto the button, it'll replace all the name and call it "search button". Any idea why?!?! I'm very puzzled. Any help will be appreciated.
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:accessbility="flash.accessibility.*" initialize="onInit()" creationComplete="onComplete()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.modernista.swffocus.SWFFocus;
private function onComplete():void {
var ap1:AccessibilityProperties = new AccessibilityProperties();
ap1.name = "search";
searchInput.accessibilityProperties = ap1;
var ap2:AccessibilityProperties = new AccessibilityProperties();
ap2.name = "name input";
nameInput.accessibilityProperties = ap2;
var sb:AccessibilityProperties = new AccessibilityProperties();
sb.name = "search button";
searchSubmit.accessibilityProperties = sb;
Accessibility.updateProperties();
}
// this helps Firefox capture and release keyboard focus
private function onInit():void {
SWFFocus.init(systemManager.stage as Stage);
}
]]>
</fx:Script>
<mx:Form defaultButton="{searchSubmit}">
<mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle" >
<mx:TextInput id="searchInput" width="540">
</mx:TextInput>
<mx:TextInput id="nameInput" width="540">
</mx:TextInput>
<mx:Button id="searchSubmit" label="search" />
</mx:HBox>
</mx:Form>
</s:WindowedApplication>
推荐答案
MS 讲述人是您只有在别无选择时才使用的工具之一.当你身处无人区时,想想那个令人毛骨悚然的旧加油站.我会使用 NVDA,一个免费的屏幕阅读器来测试应用程序,它与 JAWS 一样好,而且更易于测试与 (NVDA v. MS Narrator).
MS Narrator is one of those tools that you only use if you have no other options. Think of that creepy old gas station when you are in the middle of no where. I would test the application using NVDA, a free screen reader that is as good as JAWS, and more acceptable to test with (NVDA v. MS Narrator).
因此,我采用了另一种方法,并尝试在创建完成后创建可访问性属性.似乎叙述者有时会在开始时选择无障碍的正确名称,然后很快,当我转到按钮时,它会替换所有名称并将其称为搜索按钮"
我更愿意将这归功于讲述人的古怪.
I would attribute this more to the wonkiness of Narrator.
看起来您也没有包含辅助功能库,但我不是 Flex 开发人员,所以我不知道是否需要它们,例如在 Flash 中.
It also looks like you didn't include the Accessibility Library, but I am not a Flex dev, so I don't know if they are needed, like in Flash.
您的代码
var sb:AccessibilityProperties = new AccessibilityProperties();
sb.name = "search button";
我会在这里取出按钮.大多数辅助技术都会为事物添加元素类型,因此该按钮将被宣布为搜索按钮按钮.
I would take out button here. Most assistive tech adds on element types to things, so this button would be announced as Search button button.
进一步阅读:
- http://www.sitepoint.com/accessibility-in-flex-apps/
- http://www.adobe.com/accessibility/products/flex/best_practices.html
这篇关于桌面空中应用程序可访问性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!