ARIA - 无障碍 编辑

Accessible Rich Internet Applications (ARIA) 是能够让残障人士更加便利的访问 Web 内容和使用 Web 应用(特别是那些由JavaScript 开发的)的一套机制。

ARIA是对超文本标记语言(HTML )的补充,以便在没有其他机制的情况下,使得应用程序中常用的交互和小部件可以传递给辅助交互技术。例如,ARIA支持HTML4中的可访问导航地标、JavaScript小部件、表单提示和错误消息、实时内容更新等。

ARIA 是一组特殊的易用性属性,可以添加到任意标签上,尤其适用于 HTML。role 属性定义了对象的通用类型(例如文章、警告,或幻灯片)。额外的 ARIA 属性提供了其他有用的特性,例如表单的描述或进度条的当前值。

ARIA 在大多数流行的浏览器和屏幕阅读器中得到了实现。尽管如此,实现方式有所不同,而且旧的技术对其支持不好(或者不支持)。使用可以优雅降级的“安全的” ARIA,或者要求用户升级使用新的技术。

这些小部件中的许多后来被合并到HTML5中,如果存在这样的元素,开发人员应该更倾向使用对应的语义化HTML元素,而不是使用ARIA。例如,原生元素具有内置的键盘可访问性、角色和状态。但是,如果您选择使用ARIA,您有责任在脚本中模仿(等效的)浏览器行为。

下面是一段进度条组件的代码:

<div id="percent-loaded" role="progressbar" aria-valuenow="75"
     aria-valuemin="0" aria-valuemax="100" />

由于这个滚动条是用<div>写的,没有字面含义。然而,对开发者来说,在HTML4中,又没有更多的语义化的标签,所以我们需要引入ARIA这个角色和属性,这些是通过向元素添加属性来指定的。举个例子,role="progressbar"这个属性告诉浏览器,该元素其实是一个JavaScript实现的进度条组件。aria-valueminaria-valuemax 属性表明了进度条的最小值和最大值。 aria-valuenow则描述了当前进度条的状态, 因此它得用JavaScript来更新。

除了直接给标签加属性,还可以通过JavaScript代码把ARIA属性添加到元素并动态地更新,如下面所示:

// Find the progress bar <div> in the DOM.
 var progressBar = document.getElementById("percent-loaded");

// Set its ARIA roles and states,
// so that assistive technologies know what kind of widget it is.
 progressBar.setAttribute("role", "progressbar");
 progressBar.setAttribute("aria-valuemin", 0);
 progressBar.setAttribute("aria-valuemax", 100);

// Create a function that can be called at any time to update
// the value of the progress bar.
 function updateProgress(percentComplete) {
   progressBar.setAttribute("aria-valuenow", percentComplete);
 }

注意由于ARIA是在HTML4之后引入的,所以在HTML4或XTHML中没有提供验证。然而,它提供的可访问性收益远远超过任何技术上的无效性。

在HTML5中,所有的ARIA属性都是有效的。新的标记元素(<main><header><nav>等)都已具有了ARIA角色,所以就没必要再标注说明了。

ARIA 入门

ARIA 介绍
关于借助 ARIA 使得动态内容可访问的快速介绍。也可参考经典的 ARIA 介绍 - Gez Lemon,2008 年。
Web 应用与 ARIA FAQ
解答关于WAI-ARIA的问题并且解释为什么网站需要ARIA。
在视频频和屏幕阅读器使用 ARIA
从网上看到真实和简单的例子,包括“before”和“after”ARIA视频。
在 HTML 使用 ARIA
A practical guide for developers. It suggests what ARIA attributes to use on HTML elements. Suggestions are based on implementation realities.一份为开发人员提供实用指南。它建议一些基于基于执行的在HTML元素上使用哪些ARIA属性。

ARIA 初级进阶

通过ARIA标签增强页面导航
A nice intro to using ARIA landmarks to improve web page navigation for screen reader users. See also, ARIA landmark implementation notes and examples on real sites (updated as of July '11).
提高表单可访问性
ARIA is not just for dynamic content! Learn how to improve accessibility of HTML forms using additional ARIA attributes. 
ARIA 活动区域
活动区域为屏幕阅读器提供关于如何处理一个页面内容变更的建议。
用ARIA 活动区域去通知内容的改变
A quick summary of live regions, by the makers of JAWS screen reader software. Note that live regions are also supported by NVDA in Firefox, and VoiceOver with Safari (as of OS X Lion and iOS 5).

ARIA 与脚本组件

键盘导航与组件焦点
The first step in developing an accessible JavaScript widget is to make it keyboard navigable. This article steps through the process. The Yahoo! focus management article is a great resource as well.
Style Guide for Keyboard Navigation
A challenge with ARIA is getting developers to implement consistent behavior -- clearly best for users. This style guide describes the keyboard interface for common widgets.

ARIA 资源

Widget Techniques, Tutorials, and Examples
Need a slider, a menu, or another kind of widget? Find resources here.
ARIA-Enabled JavaScript UI Libraries
If you're starting a new project, choose a UI widget library with ARIA support already built-in. Warning: this is from 2009 -- content should be moved to an MDN page where it can be updated.
Accessibility of HTML5 and Rich Internet Applications - CSUN 2012 Workshop Materials
Includes slide presentations and examples.

邮件列表

Free ARIA Google Group
A place to ask questions about ARIA, as well as make suggestions for improving the ARIA documentation found on these pages.

博客

ARIA information on blogs tends to get out of date quickly. Still, there is some great info out there from other developers making ARIA work today.

Paciello Group

Accessible Culture

Yahoo! Accessibility

提交 Bug

File ARIA bugs on browsers, screen readers, and JavaScript libraries.

示例

ARIA 示例库
A set of barebones example files which are easy to learn from.
可访问的 JS 组件库演示
Dojo, jQueryFluid, YUI
Yahoo! 邮箱
Yahoo! puts it all together with Yahoo! Mail, a web app that almost looks like a native app. It works very well. As a review of Yahoo! Mail by screen reader Marco Zehe says, "Keep up the good work!".
Yahoo! 搜索
Yahoo! has done an amazing job of advancing ARIA here, by exercising ARIA's full capabilities and sharing their techniques. Yahoo! Search uses a combination of ARIA landmarks, live regions, and widgets.

规范特性

WAI-ARIA Activities Overview at W3C
Authoritative Overview of WAI-ARIA Standardization efforts by the Web Accessibility Initiative (WAI)
WAI-ARIA Specification
The W3C specification itself, useful as a reference. Note that, at this stage, it is important to test compatibility, as implementations are still inconsistent.
WAI-ARIA Authoring Practices
Like the W3C WAI-ARIA specification, the official best practices represents a future ideal -- a day when authors can rely on consistent ARIA support across browsers and screen readers. The W3C documents provide an in-depth view of ARIA.

For now, web developers implementing ARIA should maximize compatibility. Use best practices docs and examples based on current implementations.
Open AJAX Accessibility Task Force
The Open AJAX effort centers around developing tools, sample files, and automated tests for ARIA.
Under Construction: WCAG 2.0 ARIA Techniques
The community needs a complete set of WCAG techniques for WAI-ARIA + HTML, so that organizations can be comfortable claiming their ARIA-enabled content is WCAG compliant. This is mostly important when regulations or policies are based on WCAG.
Accessibility, AJAX, JavaScript

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:136 次

字数:12890

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文