Accessibility/WebAccessibilityAPI

From MozillaWiki
< Accessibility
Revision as of 20:53, 6 January 2015 by Surkov.alexander (talk | contribs) (Created page with "=Introduction= =Web accessibility API= ==AccessibleElement interface== This is basic interface implement by all accessible objects. <pre> interface AccessibleElement { r...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

Web accessibility API

AccessibleElement interface

This is basic interface implement by all accessible objects.

interface AccessibleElement {
  readonly attribute DOMString role;
  readonly attribute sequence<DOMString> states;

  readonly attribute DOMString name;
  readonly attribute DOMString description;
  readonly attribute DOMString value;
  readonly attribute Rect bounds; 

  readonly attribute any getAttribute(in DOMString name);
  readonly attribute sequence<AccessibleElement>? getRelations(in DOMString type);

  readonly attribute sequence<DOMString> actions;
  void activate(in unsigned int actionIndex);

  readonly attribute AccesibleElement? firstChild;
  readonly attribute AccesibleElement? lastChild;
  readonly attribute AccesibleElement? nextSibling;
  readonly attribute AccesibleElement? lastSibling;
  // do we need getChildAt and indexInParent?
};

Basic getters

AccessibleElement .role
    Returns accessible role.

Returns string representation for the accessible role of the accessible element. Examples: "button", "menu", "textfield".

AccessibleElement .states
    Returns accessible states.

Returns string list of states applied to the accessible element. Examples: "focusable", "focused", "selectable".

AccessibleElement .name
    Returns accessible name.

Returns accessible name of the accessible element.

AccessibleElement .description
    Returns accessible description.

Returns accessible description of the accessible element.

AccessibleElement .value
    Returns accessible value.

Returns accessible value of the accessible element if applicable.

AccessibleElement .bounds
    Returns boundaries of the accessible element.

Returns boundaries for the accessible element in client coordinates.


Attributes

The accessible element is free to support any kind of additional attributes of any type.

AccessibleElement .getAttribute(in DOMString name)
    Returns the attribute.

Return attribute value by the given attribute name.

Attribute list

A typical accessible element may provide the following attributes:

DOMString accessKey;
DOMString keyboardShortcut;
dictionary GroupInfo {
  unsigned int size;
  unsigned int index;
  unsigned int level;
};
GroupInfo groupInfo;

Relations

sequence<AccessibleElement> .getRelations(in DOMString type)
    Returns related accessible elements.

Return sequence of related accessible elements for given relation type.

Relation types

name_for/named_by
description_for/described_by
?do we need it

Actions

The accessible element may allow set of actions that can be invoked on it. These can be "activate" having accessible element specific semantic like "jump" or "press", or it can be generic actions like "scrollto" or "focus". Certain accessilbe actions may take extra parameters.

AccessibleElement .activate(in DOMString name, in optional any argument)
    Invokes the accessible action.

Performs the given accessible action on the accessible element.

Action list

jump
  exposed on links, base action: activate


press
  exposed on buttons, activate


activate
  exposed on accessible elements that might be activate
focus
  focus the accessible element
scroll
  scrolls the accessible element into view, may take coordinates relative the element to scroll the view to
optional argument: Position
directory Position {
  int x;
  int y;
};

AccessibleTextRange interface

Text navigation

VirtualCursor interface? AccessibleText interface?

interface AccessibleTextRange {
  //start/end points
};

Node interface

DOM Node interface should be extended by

interface Node {
  AccessibleElement? accessibleElement;
};

Taxonomies

Text navigation, role taxonomy

Extensibility

Web app and web AT can decide to extend default taxonomies to express the semantics, for example, if the web app is a music app and it provides music sheets. In that case web app can introduce new characteristics. They should follow name convention to avoid potential collisions with future additions into the spec. So that all names should be prefixed by 'x-' prefix, for example, 'x-trebleclef' or 'x-Fsharp'.

The web app can provide accessible element characteristics like role, states, etc not from the predefined list. Taxonomies should help to resolve backward compatibility issue by providing a link between new and old characteristics. For example, if web author introduces "x-redbutton' then he should provide a role taxonomy to let AT app to know this is a 'button' role.