public final class

Accessibility

extends Object
java.lang.Object
   ↳ com.google.gwt.user.client.ui.Accessibility

Class Overview

Allows ARIA attributes to be added to widgets so that they can be identified by assistive technologies. Firefox 3, Firefox 2 (via FireVox), and Opera 9.5 are the only released browsers that currently support this feature, but in the near future it will be available in Safari and Internet Explorer 8. Individual screen reader applications may also support ARIA, to varying extents.

A 'role' describes the role a widget plays in a page: i.e. a checkbox widget is assigned a "checkbox" role.

A 'state' describes the current state of the widget. For example, a checkbox widget has the state "checked", which is given a value of "true" or "false" depending on whether it is currently checked or unchecked.

See the MDC page on Accessible DHTML for more information.

Note that although this API is public, the ARIA specification is still somewhat in flux. As a result, this API is subject to change as the specification stabilizes; we will do our best to keep the community updated on changes.

Summary

Constants
String ROLE_BUTTON
String ROLE_MENUBAR
String ROLE_MENUITEM
String ROLE_TAB
String ROLE_TABLIST
String ROLE_TABPANEL
String ROLE_TREE
String ROLE_TREEITEM
String STATE_ACTIVEDESCENDANT
String STATE_EXPANDED
String STATE_HASPOPUP
String STATE_LEVEL
String STATE_POSINSET
String STATE_PRESSED
String STATE_SELECTED
String STATE_SETSIZE
Public Methods
static String getRole(Element elem)
Requests the string value of the role with the specified namespace.
static String getState(Element elem, String stateName)
Requests the string value of the state with the specified namespace.
static void removeState(Element elem, String stateName)
Removes the state from the given element.
static void setRole(Element elem, String roleName)
Assigns the specified element the specified role and value for that role.
static void setState(Element elem, String stateName, String stateValue)
Assigns the specified element the specified state and value for that state.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ROLE_BUTTON

Constant Value: "button"

public static final String ROLE_MENUBAR

Constant Value: "menubar"

public static final String ROLE_MENUITEM

Constant Value: "menuitem"

public static final String ROLE_TAB

Constant Value: "tab"

public static final String ROLE_TABLIST

Constant Value: "tablist"

public static final String ROLE_TABPANEL

Constant Value: "tabpanel"

public static final String ROLE_TREE

Constant Value: "tree"

public static final String ROLE_TREEITEM

Constant Value: "treeitem"

public static final String STATE_ACTIVEDESCENDANT

Constant Value: "aria-activedescendant"

public static final String STATE_EXPANDED

Constant Value: "aria-expanded"

public static final String STATE_HASPOPUP

Constant Value: "aria-haspopup"

public static final String STATE_LEVEL

Constant Value: "aria-level"

public static final String STATE_POSINSET

Constant Value: "aria-posinset"

public static final String STATE_PRESSED

Constant Value: "aria-pressed"

public static final String STATE_SELECTED

Constant Value: "aria-selected"

public static final String STATE_SETSIZE

Constant Value: "aria-setsize"

Public Methods

public static String getRole (Element elem)

Requests the string value of the role with the specified namespace.

Parameters
elem the element which has the specified role
Returns
  • the value of the role, or an empty string if none exists

public static String getState (Element elem, String stateName)

Requests the string value of the state with the specified namespace.

Parameters
elem the element which has the specified state
stateName the name of the state
Returns
  • the value of the state, or an empty string if none exists

public static void removeState (Element elem, String stateName)

Removes the state from the given element.

Parameters
elem the element which has the specified state
stateName the name of the state to remove

public static void setRole (Element elem, String roleName)

Assigns the specified element the specified role and value for that role.

Parameters
elem the element to be given the specified role
roleName the name of the role

public static void setState (Element elem, String stateName, String stateValue)

Assigns the specified element the specified state and value for that state.

Parameters
elem the element to be given the specified state
stateName the name of the state
stateValue the value of the state