小程序中的flex

tech2023-12-17  65

小程序中的flex

As conscientious developers we try to ensure that our applications are streamlined, self explanatory, and easy to use. We work hard to make sure they look good and lend themselves well to a given workflow, but often forget that not everyone experiences our work in the same way.

作为有责任心的开发人员,我们尝试确保我们的应用程序简化,具有自我解释性并且易于使用。 我们努力确保它们看起来不错并适合给定的工作流程,但常常会忘记并非每个人都以相同的方式体验我们的工作。

From dyslexia and color blindness to full visual impairment and mobility issues, a percentage of the population face obstacles that can make using an application difficult or even impossible. Fortunately, as Flex developers we have great support built into our chosen platform for various accessibility solutions, and can tailor our applications in several ways to make sure they work for all users.

从诵读困难和色盲到完全的视觉障碍和行动不便等问题,一定比例的人群面临着障碍,这些障碍可能使使用该应用程序变得困难甚至是不可能。 幸运的是,作为Flex开发人员,我们在选定的平台中为各种辅助功能解决方案提供了强大的支持,并且可以通过多种方式定制我们的应用程序,以确保它们适用于所有用户。

At end end of the article you’ll find a quiz, sponsored by Adobe. Test yourself and see how well you do.

在本文的结尾,您将找到由Adobe赞助的测验。 测试一下自己 ,看看自己做得如何。

什么是辅助功能? (What is Accessibility?)

Accessibility is the ability of an object to be used by anyone, regardless of a person’s incapacities. For an application to be accessible, web developers employ techniques and design concepts that enable users with any kind of impairment to navigate web pages and use software. It may involve altering the component structure, adding text to allow better interaction with screen readers, picking a color set with contrast and colour blindness in mind, or enabling full keyboard access to everything on the screen. The core idea is that your website or application is usable by those who are partially or fully blind, or who have trouble discerning one colour from another, or for whom mobility is restricted and so mouse use or gestures are difficult.

可访问性是对象可以被任何人使用的能力,而不管其人的能力如何。 为了使应用程序易于访问,Web开发人员采用了技术和设计概念,使具有各种障碍的用户能够浏览网页和使用软件。 它可能涉及更改组件结构,添加文本以更好地与屏幕阅读器进行交互,选择考虑到对比度和色盲的颜色集,或者允许完全键盘访问屏幕上的所有内容。 核心思想是,部分或完全盲目的用户,无法辨别另一种颜色的用户,移动性受到限制并因此难以使用鼠标或手势的用户都可以使用您的网站或应用程序。

Many people think of wheelchairs when they think of disabilities, but in software terms this is not necessarily a barrier; most people confined to a wheelchair can operate computer software without any difficulty.

许多人在想到残疾时都会想到轮椅,但是从软件角度来讲,这并不一定是障碍。 大多数坐在轮椅上的人可以毫无困难地操作计算机软件。

note: The D Word 注意: D字

We use the sometimes controversial term “disability” here merely as a catch-all to describe various physical and mental states, visual or auditory impairments, or other conditions. This is in no way an attempt to describe people with any kind of impairment as disabled; rather, it’s simply a term of reference that is understood by all.

在这里,我们有时会使用有争议的术语“残疾”作为通俗易懂的语言来描述各种身体和精神状态,视觉或听觉障碍或其他情况。 这绝不是试图将任何类型的残障人士描述为残疾人。 相反,这只是所有人都可以理解的职权范围。

The disabilities that are most likely to affect your users fall into four major categories and present their own challenges for developers (this list is not comprehensive, scientific, or definitive; it’s just to give you a starting place):

最有可能影响您的用户的残疾分为四个主要类别,它们对开发人员提出了自己的挑战(此列表不是全面的,科学的或确定的;它只是给您一个起点):

Visual Impairment 视力障碍

Visual impairment includes tunnel vision, color blindness, and, of course, being legally blind. Visually impaired users are often the most affected when it comes to accessibility issues, since everything done on a computer is to some extent visual. These users rely heavily on the keyboard for input and control, and tend to avoid using a mouse. A screen magnifier or screen reader provides a lot of assistance, as do audio events and cues. Some use a Braille display to “read” the text on screen with their fingertips.

视力障碍包括隧道视觉,色盲,当然还有法律上的盲目。 当涉及到可访问性问题时,视障用户通常受到的影响最大,因为在计算机上完成的所有操作在某种程度上都是可视的。 这些用户在很大程度上依靠键盘进行输入和控制,并倾向于避免使用鼠标。 屏幕放大器或屏幕阅读器可以提供很多帮助,音频事件和提示也可以提供帮助。 有些人使用盲文显示器以指尖“阅读”屏幕上的文本。

Dyslexia 阅读障碍

Dyslexic users are likely to have great difficulty reading a web page or dealing with large amounts of textual controls. In some cases this can extend to difficulty with data entry too, such as using a search function. Strategies such as logical page or screen structure can help, as well as developers adopting design philosophies that make an application as self-explanatory as possible. Dyslexic users may also use screen readers to aid with their comprehension.

阅读障碍的用户可能很难阅读网页或处理大量文本控件。 在某些情况下,这也可能会增加数据输入的难度,例如使用搜索功能。 诸如逻辑页面或屏幕结构之类的策略以及开发人员采用使应用程序尽可能自解释的设计理念都可以提供帮助。 阅读障碍的用户还可以使用屏幕阅读器来帮助他们理解。

Motor Disabilities 运动障碍

Motor disabilities can range from hand or arm tremors, a loss of limbs, or a lack of control and movement of body parts. In these cases input devices need to be considered, bearing in mind that users may be entirely unable to operate a mouse. Even if the user is unable to type, other assistive technologies exist to help them. Full keyboard navigation and control is essential for these users.

运动障碍的范围包括手或手臂震颤,四肢缺失或身体部位缺乏控制和运动。 在这些情况下,需要考虑输入设备,请记住用户可能完全无法操作鼠标。 即使用户无法打字,也存在其他辅助技术来帮助他们。 对于这些用户而言,全键盘导航和控制至关重要。

Cognitive Disabilities 认知障碍

This group is probably the farthest reaching. Disabilities may include faculty impairment such as memory recall, comprehension, and interpretation. In some cases these can be temporary situations; in others they’re permanent—and there’s no easy solution to cater for them all. This group is best served by a combination of techniques used for the other three groups, tied to an overall design philosophy aware that more and more people on the Web are not geeks or programmers, and so approach software differently from the way we expect.

这个群体可能是影响最远的群体。 残障可能包括教师的残障,例如记忆回忆,理解和解释。 在某些情况下,这可能是暂时的情况; 在另一些国家中,它们是永久性的,没有简单的解决方案可以满足所有人的需求。 该小组最好结合其他三个小组的技术来使用,并结合整体设计理念,这认识到Web上越来越多的人不是极客或程序员,因此以不同于我们期望的方式来处理软件。

Other Requirements 其他需求

For some users the solution may be as simple as ensuring that your application provides font scaling. Even if a user doesn’t consider themselves visually impaired, they may be marginally short-sighted or spend too much time looking at a screen, so being able to enlarge screen fonts can make life a great deal easier. I am a full-time software developer and writer, yet I have visual acuity problems, which makes me always appreciate being able to up the font size in an application; technically, I might fall into the visual impairment category myself.

对于某些用户,解决方案可能很简单,只需确保您的应用程序提供字体缩放即可。 即使用户不认为自己有视觉障碍,他们也可能只是近视或在屏幕上花费过多时间,因此能够放大屏幕字体可以使生活变得更加轻松。 我是一名专职软件开发人员和作家,但是我有视敏度问题,这使我总是很高兴能够增大应用程序中的字体大小。 从技术上讲,我自己可能属于视觉障碍类别。

何必呢? (Why Bother?)

There are many reasons to make the effort to build accessible software, which we’ll cover here:

努力构建可访问软件的原因很多,我们将在这里介绍:

Economics 经济学

Whether you’re running a software business that makes money from selling licenses, or heading up a project to bring a new application or workflow into an organization, you benefit from more people using the software. Statistics on computer users with a disability are difficult to come by, but the organization Blind Citizens Australia lists statistics from 2004-2005, revealing in excess of 480,000 vision-impaired people and over 50,000 fully blind. A study by the Fred Hollows Foundation mentions a World Health Organization estimate of more than 75 million people blind or vision-impaired in the world by the year 2020.

无论您经营的是通过出售许可证来赚钱的软件业务,还是负责将新应用程序或工作流程引入组织的项目,您都将从使用该软件的更多人中受益。 很难获得有关残疾计算机用户的统计数据,但是澳大利亚盲人公民组织( Blind Citizens Australia)列出了2004年至2005年的统计数据 ,显示有480,000多名视障人士和50,000多名完全失明人士。 弗雷德·霍洛斯基金会(Fred Hollows Foundation)的一项研究提到,世界卫生组织(WHO)估计, 到2020年,全世界将有7500万人失明或视力障碍 。

That’s a lot of potential users, and this is only one part of our accessibility target audience. The Disabled World community website estimates that around 10 percent of the total world’s population, or roughly 650 million people, live with some kind of disability.

潜在的用户很多,这只是我们可访问性目标受众的一部分。 残疾人世界社区网站估计 ,全世界约有6.5亿人口约占总人口的10%。

Legislation 立法

In many countries, there’s anti-discrimination legislation in place that requires web sites and applications to include at least some level of accessibility. Even stricter rules may apply in government and education sectors. The enforcement level of these acts varies wildly, but there’s always the chance of losing revenue, or being fined and forced to redevelop if you fail to meet the requirements. Be sure to check the legislation governing the nations and business sectors you’re working in. This is especially important where the software is a requirement for gaining access to any kind of government or education service or support.

在许多国家/地区,有反歧视立法 ,要求网站和应用程序至少包含一定程度的可访问性。 甚至更严格的规则可能适用于政府和教育部门。 这些行为的执行水平千差万别,但是如果您不符合要求,总会有损失收入或被罚款并被迫重新开发的机会。 确保检查有关您所在国家和商业部门的法规。在需要使用该软件以获取任何种类的政府或教育服务或支持的软件时,这尤其重要。

Technical 技术

Everyone knows that Google and other web spiders are important tools for promoting and selling software and web sites, but what you may not realise is that standard accessibility practices also can aid the spiders in indexing your pages. If you think about it, a spidering engine is essentially a blind user, reading only the text and code in your site. This is important if you’re setting up a deep-linking structure or text alternatives, and as more engines are beginning to look at spidering SWF files themselves, these techniques become even more relevant.

每个人都知道Google和其他网络蜘蛛是促进和销售软件和网站的重要工具,但是您可能没有意识到,标准的可访问性做法也可以帮助蜘蛛为您的页面编制索引。 如果您考虑一下,爬虫引擎本质上是盲目的用户,只读取站点中的文本和代码。 如果您要设置深层链接结构或替代文本,并且随着越来越多的引擎开始着眼于蜘蛛SWF文件本身,这些技术就变得尤为重要。

Doing the right thing 做正确的事

Altruism isn’t always measurable, but you can be assured that going to the effort of making your software accessible will make a lot of people happy; even those for whom accessibility is not a key issue will remember your efforts. If pure altruism isn’t enough, remember that happy and impressed customers refer others!

利他主义并不总是可以衡量的,但是可以放心的是,努力使您的软件可访问将使很多人感到高兴。 即使对于那些可访问性不是关键问题的人,也会记住您的努力。 如果单纯的无私奉献还不够,请记住,开心和印象深刻的顾客会推荐他人!

Flex provides us with a number of technical solutions for accessibility. Let’s explore some tricks and techniques you can adopt to make your applications cater for as many users as possible.

Flex为我们提供了许多可访问性的技术解决方案。 让我们探索一些技巧和技术,您可以采用这些技巧和技术使您的应用程序满足尽可能多的用户的需求。

在Flex应用程序中启用辅助功能 (Enabling Accessibility in Flex Applications)

Flex 3 applications are not accessible by default so you need to enable accessibility yourself (look out for the Flex 4 beta, though, because it now looks to be including accessibility by default). Doing so will add about 8KB to your SWF file, and there are four ways to make this happen.

默认情况下,Flex 3应用程序是不可访问的,因此您需要自己启用可访问性(不过请注意Flex 4 beta,因为它现在默认包含可访问性)。 这样做将为您的SWF文件增加大约8KB,并且有四种方法可以实现此目的。

To enable accessibility automatically for all Flex applications, you can modify your flex-config.xml file simply by setting the accessible tag to true, like so:

要为所有Flex应用程序自动启用可访问性,您只需将accessibility标记设置为true即可修改flex-config.xml文件,如下所示:

<mxml-compiler>
 … <accessible>true</accessible> …</mxml-compiler>

You can enable accessibility on a “per project” basis in Flex Builder by selecting the Generate accessible SWF file option in the Compiler options section of the project Properties dialog box shown in Figure 1, “Generate accessible SWF file”.

通过在图1“生成可访问的SWF文件”所示的项目属性对话框的“ 编译器选项”部分中选择“ 生成可访问的SWF文件”选项, 可以在Flex Builder中基于“每个项目”启用可访问性 。

Figure 1. Generate accessible SWF file

图1.生成可访问的SWF文件

To enable accessibility when you’re using the command-line compiler, you can add a configuration variable -compiler.accessible or just -accessible during compilation, like so:

要在使用命令行编译器时启用可访问性,可以在编译期间添加配置变量-compiler.accessible或just -accessible ,如下所示:

mxmlc -compiler.accessible /myapp/app.mxml

or

要么

mcml -accessible /myapp/app.mxml

Either of these methods will alter the .actionScriptProperties file in the project directory to add a compiler argument like so:

这两种方法都将更改项目目录中的.actionScriptProperties文件,以添加如下所示的编译器参数:

<compiler additionalCompilerArguments=”-locale en_US” generateAccessible=”true”>

If your application is compiled at runtime and isn’t set for accessibility by default, you can enable it on the fly by appending a query parameter to the URL like this:

如果您的应用程序是在运行时编译的,并且默认情况下未设置可访问性,则可以通过向URL附加查询参数来即时启用它:

http://www.example.com/myapp/app.mxml?accessible=true

Flex中的可访问组件 (Accessible Components in Flex)

There are 28 accessible components included in the Flex 3 SDK. For a full list of them and the accessibility enhancements they provide, check the Adobe Accessible components and containers list document. If you want to make your RIA accessible, you need to build as much as possible with fully accessible components. If you’re constructing new components, you’ll need to add accessibility support, or at least subclass an accessible component from the SDK. This excerpt is from the Adobe Accessibility Best Practices document:

Flex 3 SDK中包含28个可访问组件。 有关它们的完整列表以及它们提供的可访问性增强功能,请查看Adobe Accessible组件和容器列表文档。 如果要使RIA可以访问,则需要使用完全可访问的组件来尽可能地构建。 如果要构建新组件,则需要添加可访问性支持,或者至少要从SDK继承可访问组件。 此摘录摘自Adobe Accessibility Best Practices文档:

For a component to be accessible, it must expose role and state information according to the Microsoft Active Accessibility (MSAA) specification. Developers planning to develop their own components should plan to research and implement MSAA from the beginning to help ensure the consistent behavior of Flex components with other controls at the operating system level. Once MSAA support has been added to a control, it is important to validate that the component works with assistive technology, such as the JAWS screen reader. Screen readers rarely implement the entire MSAA spec, particularly inside of the browser, as web applications typically rely only on the 12 base controls that are included in the HTML specification. Some degree of coordination with screen reader vendors may be required if a custom-built component deviates from the approach used in the default Flex component set or a new control type is introduced.

为了使组件可访问,它必须根据Microsoft Active Accessibility(MSAA)规范公开角色和状态信息。 计划开发自己的组件的开发人员应该从一开始就计划研究和实施MSAA,以帮助确保Flex组件与其他控件在操作系统级别上的一致行为。 将MSAA支持添加到控件后,重要的是要验证组件是否与辅助技术(例如JAWS屏幕阅读器)一起使用。 屏幕阅读器很少执行整个MSAA规范,尤其是在浏览器内部,因为Web应用程序通常仅依赖HTML规范中包含的12个基本控件。 如果定制组件偏离了默认Flex组件集中使用的方法或引入了新的控件类型,则可能需要与屏幕阅读器供应商进行某种程度的协调。

屏幕阅读器 (Screen Readers)

Screen readers are applications that visually-impaired users employ to assist them in navigating websites and applications. These applications read out text and navigation items using a synthesized voice. To truly understand the experience you need to install a reader such as JAWS, and attempt to navigate your application with your monitor turned off. If you’ve never done this before, I highly recommend it for an amazing insight into the difficulties some users face.

屏幕阅读器是视障用户用来协助他们浏览网站和应用程序的应用程序。 这些应用程序使用合成语音读出文本和导航项。 要真正了解体验,您需要安装阅读器(例如JAWS) ,并尝试在关闭显示器的情况下导航应用程序。 如果您以前从未这样做过,我强烈建议您使用它来深入了解某些用户所面临的困难。

JAWS is the standard among screen readers, so it’s a good one to test against. It’s Windows-only software though, so if you’re on a Mac or Linux machine you’ll need some virtualization or dual booting set up. We’ll refer to JAWS throughout the rest of the article when referring to screen readers.

JAWS是屏幕阅读器中的标准,因此它是一个很好的测试对象。 不过,它是仅Windows的软件,因此,如果您使用的是Mac或Linux计算机,则需要进行一些虚拟化或双重启动设置。 在本文的其余部分中,当涉及屏幕阅读器时,我们将参考JAWS。

When coding for screen readers, the two most important aspects are alternative text content and reading order. As its name suggests, the reading order dictates the order in which JAWS will read aloud the contents of the screen. For a very simple application this may not be an issue, but with any kind of complex or non-standard layout, the default reading order is likely to be very confusing to a JAWS user. This affects everything from navigation to data entry; for example, if your reading order is incorrect, a user may be read the wrong form field label by JAWS, and attempt to enter the wrong data in the field they’re currently focused on. For this reason you should always run your application through JAWS to gain an idea of how it reads.

在为屏幕阅读器编码时,两个最重要的方面是替代文本内容和阅读顺序。 顾名思义,阅读顺序决定了JAWS朗读屏幕内容的顺序。 对于非常简单的应用程序,这可能不是问题,但是对于任何复杂或非标准的布局,默认的阅读顺序可能会使JAWS用户非常困惑。 这会影响从导航到数据输入的所有内容; 例如,如果您的阅读顺序不正确,则JAWS可能会向用户显示错误的表单字段标签,并尝试在他们当前关注的字段中输入错误的数据。 因此,您应该始终通过JAWS运行应用程序以了解其读取方式。

The most important point is to keep your interface simple and uncluttered, using accessible components like the accordion and tab navigator. After this, you need to assign a tabIndex value to every object in your interface, including text fields and nonfocusable interface controls.

最重要的一点是使用可折叠组件和标签导航器等可访问的组件来保持界面简洁整洁。 此后,您需要为界面中的每个对象分配一个tabIndex值,包括文本字段和不可聚焦的界面控件。

important: Careful with tabIndex 重要:小心tabIndex

If you miss even one tab Index, the entire lot will be ignored and Flex will revert to its default reading order!

如果您甚至错过了一个制表符索引,整个批次都将被忽略,Flex将恢复为默认阅读顺序!

添加说明 (Adding Instructions)

You can also choose to add instructions in various places that the screen reader can read aloud to the user. It can be helpful to include a description by entering text in the description property for the application, or the properties of the overall containers. Bear in mind though that these instructions will be read each time the user refreshes or moves to the top of an application, so if they’re too long they’ll become cumbersome. From the Adobe best practices document, here’s an example included in the Blog Reader demo application:

您还可以选择在屏幕阅读器可以向用户朗读的各个位置添加说明。 通过在应用程序的描述属性或整个容器的属性中输入文本来包含描述可能会有所帮助。 请记住,尽管每次用户刷新或移至应用程序顶部时都会阅读这些说明,所以如果它们太长,则会变得很麻烦。 在Adobe最佳实践文档中 ,这是Blog Reader演示应用程序中包含的示例:

function accessibleInit() { var desc = createObject("TextInput","desc",0); desc.x = 0; desc.y = 0; desc.width = 0; desc.height = 0; desc.accessibilityProperties = new AccessibilityProperties(); desc.accessibilityProperties.description= 'Access instructions. The Flex Blog Reader reads entries from different Blogs on the Web. To interact with this application, turn forms mode on after entering the application.';}

The function is then called from the application tag:

然后从应用程序标签调用该函数:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="accessibleInit();” pageTitle="Flex BlogReader">…

You may need to add a completely separate screen for instructions, providing a button or link to view them. It’s a good idea to have this button or link be the first detail the screen reader reads, so that the user knows they can easily get help.

您可能需要添加一个完全独立的说明屏幕,并提供一个按钮或链接来查看说明。 最好将此按钮或链接作为屏幕阅读器读取的第一个细节,以便用户知道他们可以轻松获得帮助。

工具提示和文本等效项 (Tooltips and Text Equivalents)

All controls should have tooltips containing their name and, if required, a brief statement of how they can be used. Remember that tooltips will be read out by the screen reader, so if there’s information a user needs to know about a control, put it in the tooltip. The title and description of any images should also be available in a tooltip. Make sure that if you use icon buttons in your application, they have tooltips describing their function (this is good practice in any case). If you want to add extra information to an image, you can deposit the text in the accessibilityProperties property. Here’s an another example from the Adobe documentation:

所有控件均应具有工具提示,其中应包含其名称,并在需要时简要说明如何使用它们。 请记住,工具提示将由屏幕阅读器读出,因此,如果有用户需要了解的有关控件的信息,请将其放入工具提示中。 任何图像的标题和描述也应该在工具提示中提供。 确保在应用程序中使用图标按钮时,它们具有描述其功能的工具提示(无论如何,这都是一种好习惯)。 如果要向图像添加其他信息,可以将文本存储在accessibilityProperties属性中。 这是Adobe文档中的另一个示例:

<mx:Image width="60" height="56" source="assets/icecreampint.jpg" toolTip="Ice Cream Pint" creationComplete="event.target.accessibilityProperties = new AccessibilityProperties(); event.target.accessibilityProperties.description = 'Our fine Ice Cream Pint provides the perfect serving dish for your homemade ice cream treats'"/>

When video and audio content are included it’s helpful to have a synchronized text equivalent in the form of captions. You can set this up yourself, but there are some great tools like Hi-Caption Studio from HiSoftware and MAGpie from the National Center for Accessible Media. These create a special XML file with caption data set up specifically for Flash, and can be combined with Captionate to deliver captions connected to cue points in the video. Obviously you’ll need to add a display element to your video player to show the captions where necessary.

当包含视频和音频内容时,以字幕形式显示等效的同步文本会很有帮助。 您可以自己设置,但是有一些很棒的工具,例如HiSoftware的Hi-Caption Studio和国家无障碍媒体中心的MAGpie 。 它们创建了一个特殊的XML文件,其中包含专门为Flash设置的字幕数据,并且可以与Captionate结合使用以提供与视频中的提示点相关的字幕。 显然,您需要在视频播放器中添加显示元素,以便在必要时显示字幕。

字体和颜色 (Fonts and Colors)

Font scaling should always be included in an accessible application. Give the user the ability to increase the font by choosing a scale from a select box or using a keyboard shortcut. Try to avoid the use of any particularly exotic fonts, and any nondefault fonts that are used should be embedded.

字体缩放应始终包含在可访问的应用程序中。 通过从选择框中选择比例或使用键盘快捷键,使用户能够增加字体。 尽量避免使用任何特别的外来字体,并且应该嵌入所使用的任何非默认字体。

Keep color in mind, as those who are color blind can have difficulty picking up the visual cues you take for granted. Never make color the sole means of providing information. For example, bars in a graph should have alternate text, or an outline or border can help. Colored buttons need to have tooltips; remember a color-blind user may be unable to tell the difference between a green and red button. When adding instructions, make sure you include alternative descriptions for your controls; for example, “Click the red button on the right.” In the case of links it can be useful to include an underline, as well as making the link a different color, so if the user can’t make out the color difference, they’ll still be able to recognize the link.

记住颜色,因为那些色盲的人可能很难掌握您认为理所当然的视觉提示。 切勿将颜色作为提供信息的唯一手段。 例如,图形中的条形图应具有替代文本,否则轮廓或边框会有所帮助。 彩色按钮需要有工具提示; 请记住,色盲用户可能无法分辨绿色和红色按钮之间的区别。 添加说明时,请确保包括控件的其他说明; 例如,“单击右侧的红色按钮。” 在链接的情况下,包括下划线以及使链接具有不同的颜色可能很有用,因此,如果用户无法辨别颜色差异,他们仍然可以识别链接。

Contrast is also important for readability. Focus highlights, backgrounds, and element changes due to mouseover events need to provide a strong enough contrast to be picked up by those with vision impairments. If you’re using extremely subtle changes of shade in your background or containers to help delineate text or form segments, for example, it may not be visible to many users.

对比度对于可读性也很重要。 由于鼠标悬停事件而导致的焦点高光,背景和元素变化需要提供足够强的对比度,以供视力障碍者使用。 例如,如果您在背景或容器中使用非常细微的阴影变化来帮助描绘文本或表单段,则许多用户可能看不到它。

键盘操作 (Keyboard Access)

Many users do not or can’t use the mouse, so it’s important to ensure that your application can be controlled via the keyboard. The accessible components in Flex already help with keyboard access, and you can enable the same in your own components without too much work. The key to this is making the mouse events available via the keyboard. A simple method is to add a new listener on a control and have it call the same function of a mouse click. Remember, a keyboard user will be tabbing their way through the controls on the screen, so ensure that (for example) hitting enter on a control will achieve the same result as clicking it with a mouse.

许多用户不使用或不能使用鼠标,因此确保可以通过键盘控制应用程序很重要。 Flex中的可访问组件已经对键盘访问有所帮助,您无需太多工作即可在自己的组件中启用它们。 这样做的关键是通过键盘使鼠标事件可用。 一种简单的方法是在控件上添加新的侦听器,并使其具有与单击鼠标相同的功能。 请记住,键盘用户将在屏幕上的控件之间进行切换,因此请确保(例如)在控件上按回车键将获得与使用鼠标单击相同的结果。

A second consideration is that even when a user can use the keyboard, it may still be difficult for them. Keyboard shortcuts can help in this situation; for example, mapping a key to load the help for whatever screen or section the user is focused on, and adding navigation controls mapped to keys. If you like you can create a global keyboard listener for keyboard shortcuts, and have it intercept certain keys or combinations and operate on them independently.

第二个考虑因素是,即使用户可以使用键盘,对他们来说仍然可能很困难。 键盘快捷键可以在这种情况下提供帮助; 例如,映射键以为用户关注的屏幕或区域加载帮助,并添加映射到键的导航控件。 如果愿意,可以为键盘快捷方式创建全局键盘监听器,并让其拦截某些键或组合并对其进行独立操作。

思维可及性 (Thinking Accessibility)

There are many technical challenges in developing accessible applications, but the best advice I can give is to adjust your design philosophy to take accessibility into account from the beginning. It’s much easier to develop accessibility from the beginning than try to shoehorn it into an application at the end of development.

开发可访问应用程序时遇到许多技术挑战,但是我能提供的最佳建议是调整设计理念,从一开始就考虑可访问性。 从一开始就开发可访问性比在开发结束时尝试将它扯入应用程序要容易得多。

When developing, strive for best practices like minimal container nesting; this will make screen reader adjustments easier. Think about using your application from the point of view of an impaired user; this not only helps support accessibility, but ultimately makes your software more usable for everyone. Test your application in black and white, and then with the monitor off while running JAWS and see how well it performs.

开发时,请争取最佳实践,例如最小化容器嵌套; 这将使屏幕阅读器的调整更加容易。 从残障用户的角度考虑使用您的应用程序; 这不仅有助于支持可访问性,而且最终使您的软件对每个人都更有用。 用黑色和白色测试您的应用程序,然后在运行JAWS的同时关闭监视器,查看其性能如何。

Another common and helpful path is to provide text alternatives to your pages or application. This isn’t always a suitable solution, especially for enterprise software, but in the case of smaller applications or areas where users are looking up text, deep linking and even full text alternatives to the Flex version can be very useful. Various methods are available to attempt to detect the use of screen readers, but at the moment they can be a bit hit-and-miss. Check out the useful blog post by Steve Faulkner on the subject.

另一个常见且有用的路径是为页面或应用程序提供替代文本。 这并不总是合适的解决方案,特别是对于企业软件而言,但是在较小的应用程序或用户正在查找文本的区域中,深度链接甚至是Flex版本的全文替代都非常有用。 有多种方法可以尝试检测屏幕阅读器的使用,但是目前它们可能会碰碰运气。 查看Steve Faulkner关于该主题的有用博客文章 。

Of course not all software can be made accessible; if it’s a highly visual game, like a first-person shooter or a CAD application, some kinds of disabilities will exclude users, but there’s nothing we can do there. Even in these cases there are tweaks we can do to make life easier for those who can use the software but might benefit from a little help. Ultimately, developing with accessibility in mind makes your application better all round, and expands your audience hugely.

当然,并非所有软件都可以访问。 如果是高度视觉化的游戏,例如第一人称射击游戏或CAD应用程序,则某些残障人士会将用户排除在外,但是我们无能为力。 即使在这些情况下,我们也可以进行一些调整,以使那些可以使用该软件但可能会从一些帮助中受益的人更加轻松。 最终,考虑到可访问性进行开发可以使您的应用程序全面改善,并极大地扩展您的受众。

In addition to what we’ve looked at here, there are many websites dedicated to accessibility in one form or another, and some offer great advice. There are even online services and organizations that will examine a site or application for you to test its accessibility; furthermore, when you’re developing to comply with accessibility legislation it can be helpful to have an expert look your software over. If you’re going to pay a company to make your software accessible, ensure they know what they’re doing and are providing options for various screen readers, as well as all the aspects mentioned above. Here’s a brief list of sites you may find useful:

除了我们在这里看到的内容外,还有许多专门致力于一种或多种形式的可访问性的网站,其中一些网站提供了很好的建议。 甚至还有在线服务和组织都将为您检查站点或应用程序以测试其可访问性。 此外,当您在开发时要遵守无障碍法规时,让专家来仔细研究您的软件会很有帮助。 如果您要付钱给一家公司以使您的软件可访问,请确保他们知道他们在做什么,并为各种屏幕阅读器以及上述所有方面提供了选择。 以下是您可能会觉得有用的网站的简要列表:

W3C Web Accessibility Initiative

W3C Web Accessibility Initiative

Australian Disability Discrimination Act 1992

1992年澳大利亚《残疾歧视法》

Vision Australia’s Adaptive Technology Guide

视觉澳大利亚的自适应技术指南

Australian Human Rights Commission WWW Accessibility

澳大利亚人权委员会WWW无障碍

You can also read more about Flex accessibility here:

您还可以在此处阅读有关Flex可访问性的更多信息:

Adobe Flex 3 livedocs

Adobe Flex 3 livedocs

Adobe Accessibility best practices for Flex

Flex的Adobe Accessibility最佳做法

How well do you think you’ll do on our Quiz? Test yourself and find out!

您认为您在我们的测验中的表现如何? 测试一下自己 ,找出答案!

翻译自: https://www.sitepoint.com/accessibility-in-flex-apps/

小程序中的flex

相关资源:jdk-8u281-windows-x64.exe
最新回复(0)