Dali 3D User Interface Engine
accessibility

Table of Contents

Accessibility

Introduction - What is Accessibility?

Accessibility describes functionality designed to aid usage by the visually impaired.

This includes:

Accessibility within DALi

DALi will pick up the system's current accessibility state (and subsequent changes to it) and enable its internal accessibility mode based on this.

DALi includes an Accessibility Manager which prodives public API control of the order of object selection by gesture, and text to be read out per actor or control.

It further provides many signals that represent accessibility gestures. These gestures can range from a simple actor selection through to a more control-specific concept like "page-up", which an application developer may want to provide an implementation for.

Furthermore, these APIs can be used not only with existing actors and controls, but also when creating a custom control.

The AccessibilityManager lives within DALi Toolkit. Please see accessibility-manager.h for the full API.

Accessibility Focus

accessibility-focus.png

Visibily, when enabled, accessibility will typically show an actor (or actors) as focused. This is represented by default with yellow rectangular frame around the actor. See this section for modifying the appearance of the accessibility focus.

Once in accessibility mode, normal control is disabled and accessibility gestures must be used to access content. DALi actors and controls will no longer receive tap gestures or click events when they are touched once (as they normally would).

Note: The accessibility focus is also refered to as the Focus Indicator.

Moving the focus with gestures

Accessibility recognises many gesture types to move the accessibility focus from actor to actor.

Note:

To test (and understand) this behaviour, you can use the Tizen adaptor which uses the following gestures to perform basic operation:

Note: The gestures that perform these actions are platform specific. These are the gestures implemented in the Tizen adaptor for example only.

accessibility-focus-order.png

Activation

Activation describes an operation performed on a selected actor, typically an on-tap or on-click event.

Activating an actor in accessibility mode will call a virtual function, as well as signal, for that actor. Depending on the platform this can br triggered in different ways. When activated, the built in actor types (like PushButton) will do the equivalent of a tap.

Custom-built actor types will need to implement activation in order to perform a specific behaviour. See the Custom Controls section.

Therefore, to tap an actor (EG. Click a button) in accessibility mode, the following must be done:

Scrolling

Scrolling around a view outside of accessibility is normally performed by simply holding one finger and dragging (in the appropriate direction). Within accessibility this can be overridden and performed with a different gesture type to achieve the same effect.

Example: For the Tizen platform scrolling is performed with a two-finger drag.

Basic functionality

Using the Accessibility Manager functionality

Accessibility information is stored within the accessibility manager itself rather than within actors. This allows the manager to have a global view of focusable actors and their order.

The Accessibility Manager is a singleton (owned by the singleton service) and can be accessed via its static Get() method:

// Get the accessibility manager singleton.
accessibilityManager accessibilityManager = AccessibilityManager::Get();

Controlling where the focus will move

In order to provide automatic focus movement, the accessibility manager must be told the focus order of any actors to be selected. This order is a linear order. It can move forwards or backwards only (there is no concept of "up" or "down").

The order of a particular actor can be set with a call to the accessibility manager like so:

// 6 is an int representing this actor's position in the focus chain.
accessibilityManager.SetFocusOrder( actor, 6 );

The focus order of each actor in the focus chain is unique. If there is another actor assigned with the same focus order already, the new actor will be inserted to the focus chain with that focus order, and the focus order of the original actor and all the actors followed in the focus chain will be increased accordingly.

If the focus order assigned to the actor is 0, it means that actor's focus order is undefined (e.g. the actor has a description but with no focus order being set yet) and therefore that actor is not focusable.

Moving focus to a particular actor directly can be done with SetCurrentFocusActor like so:

// Move focus to the first item on our applications page.
AccessibilityManager accessibilityManager = AccessibilityManager::Get();
accessibilityManager.SetCurrentFocusActor( table.GetChildAt( 0 ) );

Modifying the appearance of the accessibility focus

The focus graphic itself can be customised. It can be an image (EG. A nine-patch border) or any other type of actor.

It can be set using this method within C++:

accessibilityManager.SetFocusIndicatorActor( myCustomIndicatorActor );

Using activation

If the application would like to perform specific behaviour when an entity is activated, it can catch the activation by connecting to a signal like this:

AccessibilityManager::Get().FocusedActorActivatedSignal().Connect( this, &MyClass::OnFocusedActorActivated );

Controlling the activation behaviour within a custom control is covered in the custom control section

Focus groups

accessibility-focus-group.png

Group mode allows the limiting of focusable actors.

Example: If a popup appears, you may want the focus to be limited to only the OK and Cancel buttons. You can do this by setting the popup as a focus group and turning on group mode, the focus will be limited.

// Create a parent actor and add two children to it.
Actor groupActor = Actor::New();
Actor child1 = Actor::New();
groupActor.Add( child1 );
Actor child2 = Actor::New();
groupActor.Add( child2 );
AccessibilityManager accessibilityManager = AccessibilityManager::Get();
// Mark the parent as a focus group. Now focus movement *can* be limited to the children of this actor.
// Note: That this is not enabled until specified.
accessibilityManager.SetFocusGroup( groupActor, true );
// Enable the focus group mode.
accessibilityManager.SetGroupMode( true );

Wrap mode

Wrap mode allows the focus to wrap back to the beginning once the end is reached.

In group mode this will move to the beggining of the current focus group.

AccessibilityManager accessibilityManager = AccessibilityManager::Get();
// Enable wrap mode.
accessibilityManager.SetWrapMode( true );

Using Accessibility

Using accessibility with existing actors

This example sets up a 3 by 3 grid of actors with the following accessibility functionality:

Note that all the above is set via the AccessibilityManager and not as properties within the actors.

The text spoken per tile will be the LABEL, TRAIT and HINT (in that order).

Toolkit::TableView table = Toolkit::TableView::New( 3, 3 );
int tileNumber = 0;
for( int row = 0; row < 3; ++row )
{
for( int column = 0; column < 3; ++column )
{
// Create a solid color actor, with some text.
Actor tile = Toolkit::CreateSolidColorActor( Vector4( 1.0f, 1.0f, 0.0f, 1.0f ) );
Toolkit::TextLabel text = Toolkit::TextLabel::New( tileNames[tileNumber] );
tile.Add( text );
// Get the accessibility manager singleton.
accessibilityManager accessibilityManager = AccessibilityManager::Get();
// Set the focus order of this actor.
accessibilityManager.SetFocusOrder( tile, tileNumber );
// Set up the accessibility information for this actor (this will be read out with text-to-speach).
accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_LABEL, tileNames[tileNumber] );
accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_TRAIT, "Tile" );
accessibilityManager.SetAccessibilityAttribute( tile, Dali::Toolkit::AccessibilityManager::ACCESSIBILITY_HINT, "You can run this example");
// Lay out our actor within the table view.
table.AddChild( tile, Toolkit::TableView::CellPosition( row, column ) );
tileNumber++;
}
}
Stage::GetCurrent().Add( table );

Using accessibility within a custom control (C++)

Accessibility behaviour can be customized in a custom UI control by overriding all or some of the following methods.

Method Description
OnAccessibilityActivated When the control is activated or selected, in accessibility mode.
OnAccessibilityPan When an accessibility pan gesture occurs while this control is focussed.
OnAccessibilityTouch Touch events are delivered differently in Accessibility mode. This method should be overridden if some special behaviour is required when these touch events are received.
OnAccessibilityValueChange When a value is changed while this control is focussed (e.g. value change of a slider control).
OnAccessibilityZoom Should be overridden if behaviour is required when the magnification level changes when this control is focussed.

If these events are consumed, then the method should return true. The default behaviour in the control base classes returns false, i.e. not consumed.

Using accessibility signals for extra control

For more specific control of functionality when accessibility is enabled, there are several signals within the accessibility manager's public API that can be connected to.

The main catagories of signals are:

Please see accessibility-manager.h within DALi Toolkit for the full API.

Dali Docs Home
Read more about Dali