Roles (GWT Javadoc)

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.aria.client
Class Roles

    java.lang.Object
      com.google.gwt.aria.client.Roles

    public final class Roles

extends java.lang.Object

A factory providing each concrete role in the ARIA specification. Each role implements methods that a GWT application can use to modify the appropriate DOM attributes for that role.

For example, suppose our GWT app has a image button and we want to make it visible in screen readers as a button with some help text. To do this, we add a button role to the image and set the ARIA label property to the help text that the screen reader can use:

        Roles.getButtonRole().set(img.getElement());
        Roles.getButtonRole().setAriaLabelProperty(img.getElement(), "some help text");

Most ARIA properties have a prefix of "aria-" and only affect screen readers, but there is one exception: the "tabindex" property is the same one used for tab order in regular widgets. For example, to set tabindex to 0 for the button:

       Roles.getButtonRole().setTabindexExtraAttribute(img.getElement(), 0);

When the button changes state (it's enabled or disabled), we can change the ARIA enabled state to match, like this:

       Roles.getButtonRole().setAriaEnabledState(img.getElement(), isEnabled);

ARIA distinguishes between properties (which change rarely and could be set in static HTML) and states (which need to be updated in response to user input). This distinction can get a bit blurry when a GWT app updates the DOM dynamically. Generally you should update ARIA attributes at the same time that you change the CSS styles on a DOM node, so that a screen reader will see the same state as someone viewing the page visually.

The role interfaces form a hierarchy whose root is the `Role` interface, which contains generic methods that aren't specific to a role. Some abstract roles include:

1. `WidgetRole`, for DOM elements that represent either standalone or composite widgets.
2. `CompositeRole`, for widgets that contain other widgets.
3. `StructureRole`, for DOM elements that are part of the page layout.
4. `LandmarkRole`, for DOM elements defining common regions of a page.
5. `WindowRole`, for DOM elements that define windows and dialogs.

See Also:
  the W3C specification

Constructor Summary
`Roles()`

Method Summary
`static AlertdialogRole` | `getAlertdialogRole()`
`static AlertRole` | `getAlertRole()`
`static ApplicationRole` | `getApplicationRole()`
`static ArticleRole` | `getArticleRole()`
`static BannerRole` | `getBannerRole()`
`static ButtonRole` | `getButtonRole()`
`static CheckboxRole` | `getCheckboxRole()`
`static ColumnheaderRole` | `getColumnheaderRole()`
`static ComboboxRole` | `getComboboxRole()`
`static ComplementaryRole` | `getComplementaryRole()`
`static ContentinfoRole` | `getContentinfoRole()`
`static DefinitionRole` | `getDefinitionRole()`
`static DialogRole` | `getDialogRole()`
`static DirectoryRole` | `getDirectoryRole()`
`static DocumentRole` | `getDocumentRole()`
`static FormRole` | `getFormRole()`
`static GridcellRole` | `getGridcellRole()`
`static GridRole` | `getGridRole()`
`static GroupRole` | `getGroupRole()`
`static HeadingRole` | `getHeadingRole()`
`static ImgRole` | `getImgRole()`
`static LinkRole` | `getLinkRole()`
`static ListboxRole` | `getListboxRole()`
`static ListitemRole` | `getListitemRole()`
`static ListRole` | `getListRole()`
`static LogRole` | `getLogRole()`
`static MainRole` | `getMainRole()`
`static MarqueeRole` | `getMarqueeRole()`
`static MathRole` | `getMathRole()`
`static MenubarRole` | `getMenubarRole()`
`static MenuitemcheckboxRole` | `getMenuitemcheckboxRole()`
`static MenuitemradioRole` | `getMenuitemradioRole()`
`static MenuitemRole` | `getMenuitemRole()`
`static MenuRole` | `getMenuRole()`
`static NavigationRole` | `getNavigationRole()`
`static NoteRole` | `getNoteRole()`
`static OptionRole` | `getOptionRole()`
`static PresentationRole` | `getPresentationRole()`
`static ProgressbarRole` | `getProgressbarRole()`
`static RadiogroupRole` | `getRadiogroupRole()`
`static RadioRole` | `getRadioRole()`
`static RegionRole` | `getRegionRole()`
`static RowgroupRole` | `getRowgroupRole()`
`static RowheaderRole` | `getRowheaderRole()`
`static RowRole` | `getRowRole()`
`static ScrollbarRole` | `getScrollbarRole()`
`static SearchRole` | `getSearchRole()`
`static SeparatorRole` | `getSeparatorRole()`
`static SliderRole` | `getSliderRole()`
`static SpinbuttonRole` | `getSpinbuttonRole()`
`static StatusRole` | `getStatusRole()`
`static TablistRole` | `getTablistRole()`
`static TabpanelRole` | `getTabpanelRole()`
`static TabRole` | `getTabRole()`
`static TextboxRole` | `getTextboxRole()`
`static TimerRole` | `getTimerRole()`
`static ToolbarRole` | `getToolbarRole()`
`static TooltipRole` | `getTooltipRole()`
`static TreegridRole` | `getTreegridRole()`
`static TreeitemRole` | `getTreeitemRole()`
`static TreeRole` | `getTreeRole()`
`static Role` | `roleOf(Element element)` Returns the WAI-ARIA role for the `element`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Roles

    public Roles()

Method Detail

### getAlertdialogRole

    public static AlertdialogRole getAlertdialogRole()

### getAlertRole

    public static AlertRole getAlertRole()

### getApplicationRole

    public static ApplicationRole getApplicationRole()

### getArticleRole

    public static ArticleRole getArticleRole()

### getBannerRole

    public static BannerRole getBannerRole()

### getButtonRole

    public static ButtonRole getButtonRole()

### getCheckboxRole

    public static CheckboxRole getCheckboxRole()

### getColumnheaderRole

    public static ColumnheaderRole getColumnheaderRole()

### getComboboxRole

    public static ComboboxRole getComboboxRole()

### getComplementaryRole

    public static ComplementaryRole getComplementaryRole()

### getContentinfoRole

    public static ContentinfoRole getContentinfoRole()

### getDefinitionRole

    public static DefinitionRole getDefinitionRole()

### getDialogRole

    public static DialogRole getDialogRole()

### getDirectoryRole

    public static DirectoryRole getDirectoryRole()

### getDocumentRole

    public static DocumentRole getDocumentRole()

### getFormRole

    public static FormRole getFormRole()

### getGridcellRole

    public static GridcellRole getGridcellRole()

### getGridRole

    public static GridRole getGridRole()

### getGroupRole

    public static GroupRole getGroupRole()

### getHeadingRole

    public static HeadingRole getHeadingRole()

### getImgRole

    public static ImgRole getImgRole()

### getLinkRole

    public static LinkRole getLinkRole()

### getListboxRole

    public static ListboxRole getListboxRole()

### getListitemRole

    public static ListitemRole getListitemRole()

### getListRole

    public static ListRole getListRole()

### getLogRole

    public static LogRole getLogRole()

### getMainRole

    public static MainRole getMainRole()

### getMarqueeRole

    public static MarqueeRole getMarqueeRole()

### getMathRole

    public static MathRole getMathRole()

### getMenubarRole

    public static MenubarRole getMenubarRole()

### getMenuitemcheckboxRole

    public static MenuitemcheckboxRole getMenuitemcheckboxRole()

### getMenuitemradioRole

    public static MenuitemradioRole getMenuitemradioRole()

### getMenuitemRole

    public static MenuitemRole getMenuitemRole()

### getMenuRole

    public static MenuRole getMenuRole()

### getNavigationRole

    public static NavigationRole getNavigationRole()

### getNoteRole

    public static NoteRole getNoteRole()

### getOptionRole

    public static OptionRole getOptionRole()

### getPresentationRole

    public static PresentationRole getPresentationRole()

### getProgressbarRole

    public static ProgressbarRole getProgressbarRole()

### getRadiogroupRole

    public static RadiogroupRole getRadiogroupRole()

### getRadioRole

    public static RadioRole getRadioRole()

### getRegionRole

    public static RegionRole getRegionRole()

### getRowgroupRole

    public static RowgroupRole getRowgroupRole()

### getRowheaderRole

    public static RowheaderRole getRowheaderRole()

### getRowRole

    public static RowRole getRowRole()

### getScrollbarRole

    public static ScrollbarRole getScrollbarRole()

### getSearchRole

    public static SearchRole getSearchRole()

### getSeparatorRole

    public static SeparatorRole getSeparatorRole()

### getSliderRole

    public static SliderRole getSliderRole()

### getSpinbuttonRole

    public static SpinbuttonRole getSpinbuttonRole()

### getStatusRole

    public static StatusRole getStatusRole()

### getTablistRole

    public static TablistRole getTablistRole()

### getTabpanelRole

    public static TabpanelRole getTabpanelRole()

### getTabRole

    public static TabRole getTabRole()

### getTextboxRole

    public static TextboxRole getTextboxRole()

### getTimerRole

    public static TimerRole getTimerRole()

### getToolbarRole

    public static ToolbarRole getToolbarRole()

### getTooltipRole

    public static TooltipRole getTooltipRole()

### getTreegridRole

    public static TreegridRole getTreegridRole()

### getTreeitemRole

    public static TreeitemRole getTreeitemRole()

### getTreeRole

    public static TreeRole getTreeRole()

### roleOf

    public static Role roleOf(Element element)

  Returns the WAI-ARIA role for the `element`. If no 'role' attribute is set to the `element` or if the set role tokens do not include a WAI-ARIA role, null is returned. Otherwise, if a WAI_ARIA role is among the role tokens in the 'role' attribute token list, a `Role` corresponding the WAI-ARIA role is returned.

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD