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
Internet Explorer
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
the usearia
attribute to true
. For example:
The same is true of the ButtonGroup
widget:
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
checkbox
and radio
. For this reason the Button ARIA Plugin
sets the ARIA role
attribute of each Button to either checkbox
and
radio
, and the ARIA role
attribute for the root element of a
ButtonGroup to
radiogroup
.
Lastly, for Buttons of type
checkbox
and radio
, the Button ARIA Plugin automatically toggles the
aria-checked
attribute as the
Button's checked
attribute changes.
labelledby
and describedby
Attributes.
The Button ARIA Plugin adds a labelledby
and describedby
attribute to the ButtonGroup class, each of which maps back to their respective ARIA property of
aria-labelledby
and
aria-describedby
.
As indicated above, Buttons of type menu
and split
require the
Container and Menu ARIA Plugins. No additional configuration of a Button's Menu is required.
Setting the usearia
attribute to true
for a Button will automatically set
the corresponding property on its Menu. Additionally, the
aria-haspop
attribute
will automatically be set to true
for each Button's <button>
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.
You can load the necessary JavaScript and CSS for this example from Yahoo's servers. Click here to load the YUI Dependency Configurator with all of this example's dependencies preconfigured.
Note: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.
Copyright © 2011 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Copyright Policy - Job Openings