gpt4 book ai didi

apache-flex - 如何让屏幕阅读器读出 itemRenderer 组件

转载 作者:行者123 更新时间:2023-12-04 21:44:07 27 4
gpt4 key购买 nike

我们正在调整我们的 Intranet Web 应用程序以符合 WCAG 2.0。该应用程序具有复杂控件列表,但我无法读取屏幕以读取列表中的任何内容,但 labelDisplay 或列表的 labelFunction 返回的内容。

下面是一个简化的示例,“labelOne”由屏幕阅读器和列表框读取,以及列表中每个项目的 labelFunction 的结果。

<?xml version="1.0"?>
<s:Application
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:access="accessibility.*">
<fx:Script><![CDATA[
private function listLabelFunction(item : Object) : String {
return item.one;
}
]]></fx:Script>
<s:VGroup>
<access:Label id="labelOne" text="This text will be read out!"/>

<s:List hasFocusableChildren="true" labelFunction="listLabelFunction">
<s:itemRenderer>
<fx:Component>
<s:ItemRenderer>
<fx:Script><![CDATA[
import mx.controls.Alert;
]]></fx:Script>
<s:HGroup id="hGroup">
<access:Label id="labelDisplay" text="{data.one}"/>
<access:Label id="labelTwo" text="{data.two}"/>
<s:Button id="button" label="{data.button}" click="Alert.show('Ok!')"/>
</s:HGroup>
</s:ItemRenderer>
</fx:Component>
</s:itemRenderer>
<s:dataProvider>
<mx:ArrayCollection>
<fx:Object one="one" two="two" button="ok"/>
<fx:Object one="une" two="deux" button="ok"/>
<fx:Object one="uno" two="due" button="ok"/>
<fx:Object one="um" two="dois" button="ok"/>
</mx:ArrayCollection>
</s:dataProvider>
</s:List>
</s:VGroup>
</s:Application>

“访问标签”;确保标签被读出并按 Tab 键顺序排列。
package accessibility {
import mx.managers.IFocusManagerComponent;

import spark.components.Label;

public class Label extends spark.components.Label implements IFocusManagerComponent {
}
}

我也可以标签列表中的每个项目,即“labelDisplay”、“labelTwo”和“button”,但屏幕阅读器不会读出它们。

是否可以读出每个标签和按钮?

最佳答案

我有一些建议,但我不知道它们是否有效(我的屏幕阅读器在清洁工处)。

首先,您可能会发现一些 interesting reading here来自 ListAccImpl课上讲如何List类(class)与屏幕阅读器一起使用。特别要注意关于子对象(渲染器)部分中的这句话:

... the accessibility of the list items is managed by the List; the accessibilityImplementation and accessibilityProperties of the item renderers are ignored by the Flash Player.



这就解释了为什么屏幕阅读器只读出 labelDisplay 的值。或返回 labelFunction .即使您在渲染器中聚焦了一个对象,似乎 List仍然可以控制屏幕阅读器。这在 docs for the AccImpl 中得到了进一步证实。类(class)(也来自 child 部分):

The Flash Player does not support a true hierarchy of accessible objects. If a DisplayObject has an accessibilityImplementation object, then the accessibilityImplementation objects of its children are ignored.



意见建议
  • 尝试设置 focusEnabled List 的属性(property)至 false .当您在 UI 中使用 Tab 键时,渲染器中的对象仍将获得焦点,但 List本身不会。作为 AccImpl 的文档似乎暗示,List因此不会管理与屏幕阅读器的交互,它将被推迟到渲染器中的可聚焦对象。
  • 尝试扩展 List类,并覆盖它的 initializeAccessibility()方法。这个方法(我假设)由 Flex 组件生命周期调用,并且是列表获得与屏幕阅读器交互的能力的地方。如果您不初始化可访问性实现,我的想法是它将将该责任推迟到渲染器中的对象。否则它可能会崩溃并燃烧。

  • 这就是我所得到的,希望它有帮助......好问题,请分享你的发现。

    关于apache-flex - 如何让屏幕阅读器读出 itemRenderer 组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17416012/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com