This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

GNOME Accessibility Logo

Accessibility Team

ATK/AT-SPI Best Practices Guide for Implementors

DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT

2011 Joanmarie Diggs, Frederik Gladhorn

Introduction

This guide is for implementors of ATK and AT-SPI 2. It should say how to describe the user interface through the use of the AT-SPI Accessibility APIs. Having consistent representations of widgets makes the implementation of assisitive technology much easier.

ATK and AT-SPI should be identical to large parts. Especially roles and enums should be the same, so this guide applies to both.

The aim is to have a defined structure where applicable. For example an editable Combo Box should have a list or table and an editable text as children.

In addition the expected signals such as accessible-name changed should be documented so that it is clear which signals to emit.

States

Accessible objects always have a set of states. For each widget below it is mentioned which states should be implemented. Over AT-SPI2 the states are split into two 32 bit uints. (yes, it's that horrible).

FIXME link to states list

ATSPI States (from at-spi2-core/atspi/atspi-constants.c)

Some states are valid for all widgets:


Roles


Events

Focus

One of the most important events is the focus change. FIXME document here what needs to happen when focus changes.

Text Changed

As noted by Benjamin in #a11y:


Objects and their Properties

Matthias: I would really like to get some clarification about signals, when to emit them, what their expected semantics are, etc. E.g: do I emit 'visible-data-changed' when a label gains a mnemonic underline ?


Interfaces

Note from JD: For now, I'm including the Documentation along with a Do's and Don'ts. Those ultimately might need to be merged. For now, having them both makes it more obvious to me what we should be questioning, docs we might need to go back and update, etc., etc.

Most accessible objects are expected to implement a variety of interfaces based on the purpose served by the backing toolkit widget, along with the ways users can interact with that widget.

AtkAction

Description from the Documentation

AtkAction should be implemented by instances of AtkObject classes with which the user can interact directly, i.e. buttons, checkboxes, scrollbars, e.g. components which are not "passive" providers of UI information.

Exceptions: when the user interaction is already covered by another appropriate interface such as AtkEditableText (insert/delete test, etc.) or AtkValue (set value) then these actions should not be exposed by AtkAction as well.

Also note that the AtkAction API is limited in that parameters may not be passed to the object being activated; thus the action must be self-contained and specifiable via only a single "verb". Concrete examples include "press", "release", "click" for buttons, "drag" (meaning initiate drag) and "drop" for drag sources and drop targets, etc.

Though most UI interactions on components should be invocable via keyboard as well as mouse, there will generally be a close mapping between "mouse actions" that are possible on a component and the AtkActions. Where mouse and keyboard actions are redundant in effect, AtkAction should expose only one action rather than exposing redundant actions if possible. By convention we have been using "mouse centric" terminology for AtkAction names.

Note from Matthias: Should point out here that actions have keybindings associated with them. What are those good for, anyway ?

How Assistive Technologies Use This Interface

Do's and Don'ts

Implementations in the Wild

AtkComponent

Description from the Documentation

AtkComponent should be implemented by most if not all UI elements with an actual on-screen presence, i.e. components which can be said to have a screen-coordinate bounding box. Virtually all widgets will need to have AtkComponent implementations provided for their corresponding AtkObject class. In short, only UI elements which are *not* GUI elements will omit this ATK interface.

A possible exception might be textual information with a transparent background, in which case text glyph bounding box information is provided by AtkText.

How Assistive Technologies Use This Interface

Do's and Don'ts

Implementations in the Wild

AtkDocument

Description from the Documentation

The AtkDocument interface should be supported by any object whose content is a representation or view of a document. The AtkDocument interface should appear on the toplevel container for the document content; however AtkDocument instances may be nested (i.e. an AtkDocument may be a descendant of another AtkDocument) in those cases where one document contains "embedded content" which can reasonably be considered a document in its own right.

How Assistive Technologies Use This Interface

Do's and Don'ts

Implementations in the Wild

AtkHypertext and AtkHyperlinkImpl

Description from the Documentation

AtkHypertext is an interface used for objects which implement linking between multiple resource or content locations, or multiple 'markers' within a single document. A Hypertext instance is associated with one or more Hyperlinks, which are associated with particular offsets within the Hypertext's included content. While this interface is derived from Text, there is no requirement that Hypertext instances have textual content; they may implement Image as well, and Hyperlinks need not have non-zero text offsets.

AtkHyperlinkImpl allows AtkObjects to refer to their associated AtkHyperlink instance, if one exists. AtkHyperlinkImpl differs from AtkHyperlink in that AtkHyperlinkImpl is an interface, whereas AtkHyperlink is a object type. The AtkHyperlinkImpl interface allows a client to query an AtkObject for the availability of an associated AtkHyperlink instance, and obtain that instance. It is thus particularly useful in cases where embedded content or inline content within a text object is present, since the embedding text object implements AtkHypertext and the inline/embedded objects are exposed as children which implement AtkHyperlinkImpl, in addition to their being obtainable via AtkHypertext:getLink followed by AtkHyperlink:getObject.

How Assistive Technologies Use These Interfaces

Do's and Don'ts

Implementations in the Wild

Matthias: I have used the hyperlink classes in the accessible implementation for GtkLinkButton, and I'd love to know if my implementation is using these classes as intended.

AtkImage

Description from the Documentation

AtkImage should be implemented by AtkObject subtypes on behalf of components which display image/pixmap information onscreen, and which provide information (other than just widget borders, etc.) via that image content. For instance, icons, buttons with icons, toolbar elements, and image viewing panes typically should implement AtkImage.

AtkImage primarily provides two types of information: coordinate information (useful for screen review mode of screenreaders, and for use by onscreen magnifiers), and descriptive information. The descriptive information is provided for alternative, text-only presentation of the most significant information present in the image.

How Assistive Technologies Use This Interface

Do's and Don'ts

Implementations in the Wild

AtkSelection

Description from the Documentation

AtkSelection should be implemented by UI components with children which are exposed by atk_object_ref_child and atk_object_get_n_children, if the use of the parent UI component ordinarily involves selection of one or more of the objects corresponding to those AtkObject children - for example, selectable lists.

Note that other types of "selection" (for instance text selection) are accomplished a other ATK interfaces - AtkSelection is limited to the selection/deselection of children.

How Assistive Technologies Use This Interface

Do's and Don'ts

Implementations in the Wild

AtkTable

Description from the Documentation

AtkTable should be implemented by components which present elements ordered via rows and columns. It may also be used to present tree-structured information if the nodes of the trees can be said to contain multiple "columns". Individual elements of an AtkTable are typically referred to as "cells", and these cells are exposed by AtkTable as child AtkObjects of the AtkTable. Both row/column and child-index-based access to these children is provided.

Children of AtkTable are frequently "lightweight" objects, that is, they may not have backing widgets in the host UI toolkit. They are therefore often transient.

Since tables are often very complex, AtkTable includes provision for offering simplified summary information, as well as row and column headers and captions. Headers and captions are AtkObjects which may implement other interfaces (AtkText, AtkImage, etc.) as appropriate. AtkTable summaries may themselves be (simplified) AtkTable, etc.

How Assistive Technologies Use This Interface

Do's and Don'ts

Implementations in the Wild

AtkText

Description from the Documentation

AtkText should be implemented by AtkObjects on behalf of widgets that have text content which is either attributed or otherwise non-trivial. AtkObjects whose text content is simple, unattributed, and very brief may expose that content via atk_object_get_name instead; however if the text is editable, multi-line, typically longer than three or four words, attributed, selectable, or if the object already uses the 'name' ATK property for other information, the AtkText interface should be used to expose the text content. In the case of editable text content, AtkEditableText (a subtype of the AtkText interface) should be implemented instead.

AtkText provides not only traversal facilities and change notification for text content, but also caret tracking and glyph bounding box calculations. Note that the text strings are exposed as UTF-8, and are therefore potentially multi-byte, and caret-to-byte offset mapping makes no assumptions about the character length; also bounding box glyph-to-offset mapping may be complex for languages which use ligatures.

AtkEditableText should be implemented by UI components which contain text which the user can edit, via the AtkObject corresponding to that component (see AtkObject).

AtkEditableText is a subclass of AtkText, and as such, an object which implements AtkEditableText is by definition an AtkText implementor as well.

How Assistive Technologies Use These Interface

Do's and Don'ts

As a general rule, only implement AtkText for widgets which:

Thus you DO want to implement AtkText for:

You do NOT want to implement AtkText for:

Implementations in the Wild

AtkValue

Description from the Documentation

AtkValue should be implemented for components which either display a value from a bounded range, or which allow the user to specify a value from a bounded range, or both. For instance, most sliders and range controls, as well as dials, should have AtkObject representations which implement AtkValue on the component's behalf. AtkValues may be read-only, in which case attempts to alter the value return FALSE to indicate failure.

How Assistive Technologies Use This Interface

Do's and Don'ts

Implementations in the Wild


Relations

Add the AtkRelation types here


Widgets

Two main properties of widgets are Name and Description. The name reflects the primary text for the widget: The text of a label, the text on a button. The description gives additional information: A button labeled "OK" could have the description "Accepts the dialog". FIXME more sensible example?

Label

Structure of Accessibles and their roles.

States:

Events:

Interfaces:

Button

Structure of Accessibles and their roles.

States:

Events:

Interfaces:

Line Edit

Structure of Accessibles and their roles.

States:

Events:

Interfaces:

This is the menu bar of an application - File, Edit etc.

There is one menu bar as root element, it has any number of menu as children. menu can have menu and menu item as children. menu item does not have children.

List

A list has only one column. It contains items.

States: STATE_MANAGES_DESCENDANTS

Events: FIXME: what do we need? active descendant and more black magic

Interfaces: Table

Table

current state in gtk: it would be difficult to provide row objects

Web: firefox usually has rows, but sometimes it can happen that rows are not present (like html role presentation or css hidden)

should headers be mandatory? should it be table header row for the first row?

IA2: all cells are children of the table object. there are no row objects. like gtk.

One big concern was notifications about selection changes. It would be great to get notified for things such as row selected. There are two ways to tackle this: in the first approach (gtk) we could define a signal: rows-selected() and rows-deselected or somesuch in the second approach with rows, the row object could be sent as selected. this has the downside that there is no way to do the same for columns. it is less flexible. IA2 has functions to get selected rows/columns

States:

Events:

Interfaces:

Trees

The reason for the variety of trees that are possible is mostly that ARIA has very flexible tree definitions. The web implementators will simply expose that.

Tree has exactly one column. For trees with more than one column the tree table has to be used.

Tree items can contain a grouping element. In the grouping element it can have other items.

Tree 1: define hierarchy through relations and group positions

This tree works with add/remove tree items when they get expanded/collapsed.

Tree 2: real hierarchy

The items are arranged as children.

No need for add/remove for expanding/collapsing of sub items.

Tree 3: Tree Table

Tree tables can not be hierarchical. tree table can have more than one column

States:

Events:

Interfaces:

Scroll Bars

Structure of Accessibles and their roles.

States:

Events:

Interfaces:

Combo Box

The Accessible Name of the combo box accessible is the current text that is displayed. This text can be typed by the user or one of the selected items.

States: Focused, Editable

Events: Focus

Interfaces: None required

The name of the ATSPI_ROLE_COMBO_BOX should always reflect the current text. FIXME: what should combo box send when the current item/text changed?

Foo Bar Template

Structure of Accessibles and their roles.

States:

Events:

Interfaces:

Stuff we Mustn't Forget

(But are not sure where all to put it yet.)


2024-10-23 10:57