Revision Content

Summary

The nsIAccessible interface is a cross-platform interface that supports platform-specific accessibility APIs like MSAA and ATK. Contains the sum of what's needed to support IAccessible as well as ATK's generic accessibility objects.

Can also be used by in-process accessibility clients to get information about objects in the accessible tree. The accessible tree is a subset of nodes in the DOM tree -- such as documents, focusable elements and text. Mozilla creates the implementations of nsIAccessible on demand.

The 0-based index of this accessible in its parent's list of children, or -1 if this accessible does not have a parent.

name

AString

Accessible name -- the main text equivalent for this node.

value

AString

Accessible value -- a number or a secondary text equivalent for this node. Widgets that use role attribute can force a value using the valuenow attribute.

description

AString

Accessible description -- long text associated with this node.

keyboardShortcut

AString

Provides localized string of accesskey name, such as Alt+D. The modifier may be affected by user and platform preferences. Usually alt+letter, or just the letter alone for menu items..

defaultKeyBinding

AString

Provides localized string of global keyboard accelerator for default action, such as Ctrl+O for Open file.

role

unsigned long

Natural enumerated accessible role for the associated element. The values depend on platform because of variations. See the ROLE_* constants defined in {{ Interface("nsIAccessibleRole") }}.

This does not take into account role attribute as the finalRole does.

finalRole

unsigned long

Enumerated accessible role. The values depend on platform because of variations. See the ROLE_* constants defined in {{ Interface("nsIAccessibleRole") }}. Widgets can use role attribute to force the final role

Methods

getKeyBindings()

This method provides array of localized string of global keyboard accelerator for the given action index supported by accessible.

nsIDOMDOMStringList getKeyBindings(
in PRUint8 aActionIndex
);

Parameters

aActionIndex

Index of the given action.

Return value

Returns array of localized string of global keyboard accelerator.

getFinalState()

This method retrieves a final state. Accessible states -- bit fields which describe boolean properties of node. Many states are only valid given a certain role attribute that supports them.

void getFinalState(
out unsigned long aState,
out unsigned long aExtraState
);

Parameters

aState

The first bit field (See: {{ Interface("nsIAccessibleStates") }} STATE_* constants).

aExtraState

The second bit field (See: {{ Interface("nsIAccessibleStates") }} EXT_STATE_* constants).

groupPosition()

This method returns grouping information. Used for tree items, list items, tab panel labels, radio buttons, etc. Also used for collectons of non-text objects.

void groupPosition(
out long aGroupLevel,
out long aSimilarItemsInGroup,
out long aPositionInGroup
);

Parameters

aGroupLevel

1-based, similar to ARIA level property.

aSimilarItemsInGroup

1-based, similar to ARIA setsize property, inclusive of the current item.

aPositionInGroup

1-based, similar to ARIA posinset property.

getChildAtPoint()

This method returns an accessible child which contains the coordinate at (x, y) in screen pixels.

If the point is in the current accessible but not in a child, the current accessible will be returned.

If the point is in neither the current accessible or a child, then NULL will be returned.

nsIAccessible getChildAtPoint(
in long x,
in long y
);

Parameters

x

Accessible's X-coordinate.

y

Accessible's Y-coordinate.

Return value

Returns an accessible child at given (x, y) coordinate.

getChildAt()

This method returns Nth accessible child using zero-based index or last child if index than less than zero.

nsIAccessible getChildAt(
in long aChildIndex
);

Parameters

aChildIndex

The index of the Nth child.

Return value

Returns Nth accessible child using zero-based index or last child if index is less than zero.

getAccessibleToRight()

This method returns an accessible node geometrically to the right of this one.

nsIAccessible getAccessibleToRight();

Parameters

None.

Return value

Returns an accessible node geometrically to the right of this one.

getAccessibleToLeft()

This method returns an accessible node geometrically to the left of this one.

nsIAccessible getAccessibleToLeft();

Parameters

None.

Return value

Returns an accessible node geometrically to the left of this one.

getAccessibleAbove()

This method returns an accessible node geometrically above this one.

nsIAccessible getAccessibleAbove();

Parameters

None.

Return value

Returns an accessible node geometrically above this one.

getAccessibleBelow()

This method returns an accessible node geometrically below this one.

nsIAccessible getAccessibleBelow();

Parameters

None.

Return value

Returns an accessible node geometrically below this one.

getAccessibleRelated()

This method returns an accessible related to this one by the given relation type (See: constants defined in {{ Interface("nsIAccessibleRelation") }}).

nsIAccessible getAccessibleRelated(
in unsigned long aRelationType
);

Parameters

aRelationType

The relation type between the accessible.

Return value

Returns an accessible which is related to the one provided by the given relation type.

getRelation()

This method returns one accessible relation for this object.

nsIAccessibleRelation getRelation(
in unsigned long index
);

Parameters

index

The index for which relation is to be retrieved.

Return value

Returns one accessible relation for this object.

getRelations()

This method returns multiple accessible relations for this object.

nsIArray getRelations();

Parameters

None.

Return value

Returns multiple accessible relations for this object.

getBounds()

This method returns accessible's (x and y) coordinates relative to the screen and accessible's width and height.

void getBounds(
out long x,
out long y,
out long width,
out long height
);

Parameters

x

Accessible's X-coordinate.

y

Accessible's Y-coordinate.

width

Accessible's width.

height

Accessible's height.

Return value

Returns accessible's (x and y) coordinates relative to the screen and accessible's width and height.

setSelected()

This method adds or remove this accessible to the current selection.

void setSelected(
in boolean isSelected
);

Parameters

isSelected

The current selection.

extendSelection()

This method extends the current selection from its current accessible anchor node to this accessible.

void extendSelection();

Parameters

None.

takeSelection()

This method selects this accessible node only.

void takeSelection();

Parameters

None.

takeFocus()

This method focuses this accessible node.

The state STATE_FOCUSABLE indicates whether this node is normally focusable. It is the callers responsibility to determine whether this node is focusable.accTakeFocus on a node that is not normally focusable (such as a table), will still set focus on that node, although normally that will not be visually indicated in most style sheets.

void takeFocus();

Parameters

None.

getActionName()

This method retrieves the name of the accessible action at the given zero-based index.

AString getActionName(
in PRUint8 index
);

Parameters

index

The zero-based index.

Return value

Returns the name of the accessible action.

getActionDescription()

This method retrieves the description of the accessible action at the given zero-based index.

AString getActionDescription(
in PRUint8 aIndex
);

Parameters

aIndex

The zero-based index.

Return value

Returns the description of the accessible action.

doAction()

This method performs the accessible action at the given zero-based index. Action number 0 is the default action.