加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-15 01:49:25 所属栏目:百科 来源:网络整理
导读:我们正在调整我们的Intranet Web应用程序以符合WCAG 2.0标准.该应用程序具有复杂控件的列表,但我无法读取屏幕读取列表中的任何内容,但labelDisplay或whats由列表的labelFunction返回. 下面是一个简单的例子,屏幕阅读器和listBox读
我们正在调整我们的Intranet Web应用程序以符合WCAG 2.0标准.该应用程序具有复杂控件的列表,但我无法读取屏幕读取列表中的任何内容,但labelDisplay或whats由列表的labelFunction返回.

下面是一个简单的例子,屏幕阅读器和listBox读取“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>

“访问标签”;确保标签被读出并按标签顺序排列.

package accessibility {
import mx.managers.IFocusManagerComponent;

import spark.components.Label;

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

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

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

解决方法

我有几个建议,但我不知道它们是否会起作用(我的屏幕阅读器是清洁工).

首先,您可能会从ListAccImpl类中找到有关List类如何与屏幕阅读器配合使用的一些interesting reading here.特别是,请注意有关子对象(渲染器)的部分中的这句话:

… 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课程(也来自儿童部分)得到进一步证实:

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.

建议

>尝试将List的focusEnabled属性设置为false.当您在UI中进行选项卡时,渲染器中的对象仍然会聚焦,但List本身不会聚焦.由于AccImpl的文档似乎暗示,因此List不会管理与屏幕阅读器的交互,并且它将被延迟到渲染器中的可聚焦对象.
>尝试扩展List类,并覆盖它的initializeAccessibility()方法.这个方法(我假设)由Flex组件生命周期调用,并且是列表能够与屏幕阅读器进行交互的地方.如果你没有初始化可访问性实现,我的想法是它会将这个责任推迟到渲染器中的对象.或者它可能崩溃和燃烧.

这就是我所得到的,希望它有所帮助…好问题,请分享你找到的东西.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读