Provide Keyboard Accessibility
Flash makes it easy to give users a choice between the mouse and the keyboard for interacting with Flash content. However, sometimes keyboard access is not automatic. You must be sure to add keyboard access when it is not automatically provided. If you are a mouse user, read this introduction to keyboard accessibility.
Tab, Space, Enter and Arrow Keys
Keyboard users expect:
- The Tab key will move to the next actionable control.
- Shift+Tab will move to the previous actionable control.
- Space will activate a button, check a checkbox, manipulate a control or type a space in a text field or text area.
- Enter will activate a button or start a new line in a text area.
- Arrow keys (up and down) will move among the choices in a menu, a list component, a combo box component or a group of radio buttons, selecting them without activating them, and move among the lines in a text area.
There is no need to listen for these key presses in Flash. Pressing space or Enter triggers the standard Flash event handler for mouse clicks. Standard Flash components handle arrow keys appropriately. And the Tab key and Shift+Tab keystroke are handled through properties assigned to the element, as explained in the Controlling Reading Order and Tab Order lesson.
In fact, manually listening for Enter and space key presses would not work correctly for screen readers. When screen readers are in virtual cursor/browse mode, for reading the screen quickly instead of interacting with it, they trap keys such as Enter and space and will not send them through to the Flash application.
Instead, ensure that all actionable items are tab-enabled by setting the appropriate properties, use standard components or correctly implement custom ones, and monitor the proper Flash event that covers activation by a mouse click, Enter or space.
Ensuring keyboard access is straightforward for developers, however, it can be a challenge for the layout designer and the person writing support documentation and on-screen text. For example, the instructive terms "choose," "select" and "activate" are more appropriate for keyboard and mouse users than the terms "click on" or "drag," which are more mouse dependent. Planning the tab order from the start will produce layouts that are easier to write keyboard-based instructions for and to code.
Shortcuts and Mnemonics
As you experienced on the previous page, tabbing gets tiring when you know where you want to go and you must press the Tab key repeatedly to get there. For users who have mobility impairments, it may be even more tiring. A shortcut or mnemonic key makes getting there a lot easier and provides a more equivalent experience for keyboard-only users.
Mnemonics are shortcuts that use a letter from the name of the control or list item. The letter is then underlined in that name. For example, Ctrl+P is a standard mnemonic, in many applications, for a Print button or Print menu item. F1 is a common non-mnemonic shortcut for Help. Because operating systems, web browsers and screen readers use many shortcuts, we include a topic in this lesson on choosing good shortcuts for your Flash application.
While specific technical requirements do not exist for when to include shortcuts, a general functional rule of thumb is to add a shortcut or mnemonic in the following types of controls:
- Requires pressing the Tab key more than 5 times to reach
- Controls media playback
- Needed quickly, such as to silence audio or stop repeated updates of content
Using shortcuts in these situations will address two of the checkpoints on the VHA Functional Checklist.
Shortcuts and mnemonics always require adding ActionScript code to recognize when the shortcut is typed. This is true whether the shortcut is communicated to the screen reader using the shortcut property in the Accessibility Panel or ActionScript. Refer to the How-To section of this document for instructions on how to create working keyboard shortcuts.
Keyboard Accessibility of Dynamic Text
Users of screen readers like JAWS and Window-Eyes also rely on the keyboard for access. In addition to including all actionable controls in the tab order, these text items belong in the tab order or should have a shortcut key assigned to them:
- Text that changes for any reason
- Error messages and other very important text
- License text
- Alerts text
See the Controlling Reading Order and Tab Order lesson for details on making sure users of screen readers can access all relevant Flash content in the right order.
Objects that Should Not be in the Tab Order
In Flash, it is easy to hide an object temporarily just by layering another one on top or moving it slightly off-stage. This hides it from sight, but not from the keyboard. The Flash Player places these tab-enabled items in the tab order in this case. For example, the Flash Player may place seemingly disabled objects, like a Back button that does not work at the beginning of a set of slides or pages, in the tab order.
When you hide an object or disable it, check that you can no longer tab to it. If you can tab to it, make one of these changes:
- For a movie clip, set the tab-enabled property to false.
- For a component within a movie clip, set the Tab Children property to false on the parent movie clip.
- For other components, set the Focus Enabled property to false.
In the rest of this topic are a few exceptions in which a hidden or disabled object should be tab-enabled or in the tab order. However, most should not be keyboard accessible or in the tab order until they are visible and enabled again.
Select Next to learn more about objects that must be keyboard accessible.