Using redundant keyboard and mouse event handlers in Flash

Important Information about Techniques

See Understanding Techniques for WCAG Success Criteria for important information about the usage of these informative techniques and how they relate to the normative WCAG 2.1 success criteria. The Applicability section explains the scope of the technique, and the presence of techniques for a specific technology does not imply that the technology can be used in all situations to create content that meets WCAG 2.1.

Applicability

Note

Adobe has plans to stop updating and distributing the Flash Player at the end of 2020, and encourages authors interested in creating accessible web content to use HTML.

This technique relates to Success Criterion 2.1.1: Keyboard (Sufficient as a way to meet FLASH17: Providing keyboard access to a Flash object and avoiding a keyboard trap).

Description

The objective of this technique is to demonstrate how to provide device independence by providing equivalent event handlers in response to a mouse or focus event. Supporting both mouse and keyboard events ensures that users will be able to perceive the same information, regardless of the input device they used. If the event changes the state of the control, it may be important to change the descriptive name of the control in the event handlers.

Examples

Example 1: Updating button text with multiple event handlers

In this example, a group of buttons is assigned the same event handlers for the flash.events.FocusEvent.FOCUS_IN and flash.events.MouseEvent.MOUSE_OVER events. When a button receives focus or is hovered over using a mouse, text describing the button will be updated.

import fl.accessibility.ButtonAccImpl;
import fl.controls.Button;
import flash.accessibility. *
import flash.events.FocusEvent;
import flash.events.MouseEvent;
import flash.net.navigateToURL;
import flash.net.URLRequest;

ButtonAccImpl.enableAccessibility();
var states: Object = {
  "Alabama": "Alabama is a state located in the southeastern region of the \
    United States of America.",
  "California": "California is the most populous state in the United States",
  "New York": "New York is a state in the Mid-Atlantic and Northeastern \
    regions of the United States"
};

var buttons: Array =[];
var button: Button;
var accProps: AccessibilityProperties;
var count = 0;
for (var i in states) {
  button = new Button();
  button.label = i;
  button.addEventListener(MouseEvent.CLICK, clickHandler);
  button.addEventListener(MouseEvent.MOUSE_OVER, highlightHandler);
  button.addEventListener(MouseEvent.MOUSE_OUT, unHighlightHandler);
  button.addEventListener(FocusEvent.FOCUS_IN, highlightHandler);
  button.addEventListener(FocusEvent.FOCUS_OUT, unHighlightHandler);
  accProps = new AccessibilityProperties();
  accProps.description = states[i];
  button.accessibilityProperties = accProps;
  addChild(button);
  button.x = 30
  button.y = 30 + count * 30;
  buttons[i] = button;
  count++;
}

function highlightHandler(e) {
  descText.text = states[e.target.label];
}

function unHighlightHandler(e) {
  descText.text = "";
}


function clickHandler(e) {
  var url: URLRequest = new URLRequest("http://www.wikipedia.org/wiki/" + e.target.label);
  navigateToURL(url, "_self");
}
Note

To improve accessibility for screen reader users, the descriptive text is also attached to the buttons themselves as an accessible description. Also note that for button components, the MouseEvent.CLICK event will fire on mouse clicks as well as when the Enter key is pressed.

This technique is illustrated in the working version of Updating button text with multiple event handlers. The source of Updating button text with multiple event handlers is available.

Tests

Procedure

For all scripted event handlers in a Flash Movie,

  1. Confirm that event handlers are assigned for both mouse and keyboard events

Expected Results

  • The above is true