翻译正在进行中。

Accessible Rich Internet Applications (ARIA) 规定了能够让 Web 内容和 Web 应用(特别是那些由 Ajax 和 JavaScript 开发的)对于残障人士更易使用的各种机制。例如,ARIA 提供了易用的导航地标、JavaScript 组件、表单提示以及错误信息、实时内容更新等。

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

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

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

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

由于这个滚动条是用div写的,没有字面含义。然而,对开发者来说,在HTML4中,又没有更多的语义化的标签,所以我们需要引入ARIA这个角色和属性,来给元素增加特定的属性。举个例子,role="progressbar"这个属性告诉浏览器,该元素其实是一个JavaScript实现的进度条组件。aria-valuemin aria-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> etc)都已具有了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 Live Regions(正在完善中)
Live regions provide suggestions to screen readers about how to handle changes to the contents of a page.
用ARIA Live Regions去通知内容的改变
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

 

文档标签和贡献者

最后编辑者: mdnwebdocs-bot,