Applications shall expose information and mechanisms necessary to track focus, text insertion point, and selection attributes of user interface components.

Rationale

Even if the software provides keyboard access so users can navigate the software, the focus location, selection state and text insertion point information must also be programmatically available to assistive technology. Assistive technology (e.g., screen reader, screen magnifier) needs to know the position and contents of the visual focus indicator, so it can describe, magnify or manipulate the focused object for the user.

When editing, the caret or insertion bar is the visual focus. As a blind user moves the focus with the arrow keys, a screen reader must know the position of that focus so that it can echo the current character, word or line. Similarly, as a user tabs around a dialog, a screen magnifier needs to follow the visual focus and does that using the programmatic focus information.

Development Techniques

Note: Review the General techniques as well as other tabs applicable to your technology.  Prioritize the use of technology-specific techniques, and implement the General techniques as needed. You are always required to find, understand and implement accessible code techniques to meet the checkpoint. The documented techniques and supplements are not exhaustive; they illustrate acceptable ways to achieve the spirit of the checkpoint. If numbered, techniques are in order of preference, with recommended techniques listed first.

General techniques

Instructions: Complete both items in this section to meet this checkpoint.

  • Providing support for a focus indicator that responds to user input AND
  • Programmatically exposing the focus information to assistive technology

Mobile Native (iOS) techniques

Instructions: In addition to the General Techniques, each item in this section represents a technique or combination of techniques deemed sufficient where applicable.

Note: This example also appears in, and is relevant to, Checkpoint 2.4.7 - Focus Visible.

Make sure focus, text insertion point, and selection attributes of user interface components are trackable and modifiable

When you use the standard iOS controls, set the accessibility attribute of each control. In Interface Builder, this is done by selecting the Accessibility checkbox Enabled found on the Identity Inspector tab.

Accessibility can be enabled programmatically with the setIsAccessibilityElement and setAccessibilityLabel methods:

[self.myButton setIsAccessibilityElement:YES];
[self.myButton setAccessibilityLabel: @"label text for button"];

Eclipse techniques

Instructions: In addition to the General techniques, items in this section represent a combination of techniques deemed sufficient where applicable.

Providing support for a visual focus indicator that responds to user input

When using the Eclipse Standard Widget Toolkit no additional programming is required to provide visual focus. SWT notifies assistive technology when a window gets focus through the org.eclipse.swt.accessibility package support.

Programmatically exposing the focus information to assistive technology.

In Eclipse, custom controls should call Control.getAccessible().setFocus() whenever the custom control sets focus to one of its internal items. This will notify Active Accessibility of a focus change.

Please note you should never call Control.forceFocus() because this can result in a widget having focus that does not have a focus indicator and does not respond to keyboard input. It is better to call Control.setFocus() however even this should not be called without good reason because it is confusing to have the focus change randomly and independent of the user's actions. And finally, calling Control.setFocus or Control.forceFocus is not the equivalent to the NotifyWinEvent described for non-Eclipse applications in example provided for Software developers for this technique.

Windows-based (MSAA+IA2) techniques

Instructions: In addition to the General techniques, refer to the Windows techniques tab in checkpoint 502.3.1 Object Information to learn about accessibility APIs, and use the following to support Windows accessibilty.

Using standard Windows controls

When using standard Windows controls, no additional work is required to provide visual focus. Windows notifies assistive technology when a window gets focus by using the Microsoft Active Accessibility (MSAA) interface, window hooks, and window messages.

Providing object focus by positioning the system caret on the focus object

Object focus can also be provided by positioning the system caret on the focus object. The system caret is the blinking vertical bar that the user sees when editing text. The caret can be placed anywhere on the screen, made any shape or size, and even made invisible. If the system caret is made invisible, it can be moved to indicate the focus location to assistive technology without disturbing what the user sees on the screen. This technique will expose the focus to assistive technology; but there must still be a visual indication of the focus object.

Programmatically exposing the focus information to assistive technology

Software that creates custom controls must support the Microsoft Active Accessibility (MSAA) to expose the object focus location.

Software must call NotifyWinEvent whenever the focus moves to an object that does not correspond to an entire window. It must handle the WM_GETOBJECT message when that is used to query the focus object. COM objects representing screen elements must also support the accSelection property. For more information about MSAA, refer to the Microsoft Active Accessibility Web site.


Most links in this checklist reside outside ibm.com at the Web Content Accessibility Guidelines (WCAG) 2.0. W3C Recommendation 11 December 2008: http://www.w3.org/TR/WCAG20/

Copyright © 1994-2017 World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University, Beihang University). All Rights Reserved.

Copyright © 2001, 2017 IBM Corporation