The Button ARIA Plugin makes it easy to use the WAI-ARIA Roles and States with the Button and ButtonGroup controls. Using the ARIA plugin, Buttons are more interoperable with assistive technologies (AT), such as screen readers, making them more accessible to users with disabilities.
Watch a screen cast of this example running in Firefox 3 with the NVDA screen reader, to see immediately the benefits that ARIA provides, or download the latest development snapshot of NVDA to test this example for yourself.
Using the Button ARIA Plugin is easy. Simply include the source file(s) for the ARIA plugin after the Button source files as indicated on the Button landing page.
All YUI ARIA Plugins require the user's browser and AT support the WAI-ARIA Roles and States.
Currently only Firefox 3 and
8 have support for ARIA, and are supported by several screen readers for
Windows that also offer support for ARIA. For this reason the YUI ARIA Plugins are only enabled
by default for these browsers. To enable the ARIA plugin for other browsers, simply the set
usearia attribute to
true. For example:
The same is true of the
All Buttons (with the exception of those of type
link) created using the Button
widget are represented in HTML using the
<button> element. While this element
suits most applications, it doesn't convey the correct role information for Buttons of type
radio. For this reason the Button ARIA Plugin
sets the ARIA
role attribute of each Button to either
radio, and the ARIA
role attribute for the root element of a
Lastly, for Buttons of type
radio, the Button ARIA Plugin automatically toggles the
aria-checked attribute as the
checked attribute changes.
As indicated above, Buttons of type
split require the
Container and Menu ARIA Plugins. No additional configuration of a Button's Menu is required.
usearia attribute to
true for a Button will automatically set
the corresponding property on its Menu. Additionally, the
will automatically be set to
true for each Button's
element so that users of AT know that the Button has a corresponding Menu. The Menu's
labelledby configuration property will automatically be set to the id of the
Button, to further associate the Menu with its corresponding Button for users of AT.
Two of the leading screen readers for Windows, JAWS and Window-Eyes, support ARIA. Free, trial versions of both are available for download, but require Windows be restarted every 40 minutes. The open-source NVDA Screen Reader is the best option for developers as it is both free and provides excellent support for ARIA.
Note: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.