Using ADF Faces Table components in Screen Reader mode

Developing Accessible ADF Faces Pages 22-9

22.3.4 How to Define Access Keys for an ADF Faces Component

In the Property Inspector of the component for which you are defining an access key, enter the mnemonic character in the accessKey attribute field. When simultaneously setting the text, label, or value and mnemonic character, use the ampersand character in front of the mnemonic character in the relevant attribute field. Use one of four attributes to specify a keyboard character for an ADF Faces input or command and go component: ■ accessKey: Use to set the mnemonic character used to gain quick access to the component. For command and go components, the character specified by this attribute must exist in the text attribute of the instance component; otherwise, ADF Faces does not display the visual indication that the component has an access key. Example 22–1 shows the code that sets the access key to the letter h for the af:goLink component. When the user presses the keys ALT+H, the text value of the component will be brought into focus. Example 22–1 AccessKey Attribute Defined af:goLink text=Home accessKey=h ■ textAndAccessKey: Use to simultaneously set the text and the mnemonic character for a component using the ampersand character. In JSPX files, the conventional ampersand notation is amp;. In JSP files, the ampersand notation is simply . In the Property Inspector, you need only the . Example 22–2 shows the code that specifies the button text as Home and sets the access key to H, the letter immediately after the ampersand character, for the af:commandButton component. Example 22–2 TextAndAccessKey Attribute Defined af:commandButton textAndAccessKey=amp;Home ■ labelAndAccessKey: Use to simultaneously set the label attribute and the access key on an input component, using conventional ampersand notation. Example 22–3 shows the code that specifies the label as Date and sets the access key to a, the letter immediately after the ampersand character, for the af:selectInputDate component. Example 22–3 LabelAndAccessKey Attribute Defined af:inputSelectDate value=Choose date labelAndAccessKey=Damp;ate ■ valueAndAccessKey: Use to simultaneously set the value attribute and the access key, using conventional ampersand notation. Example 22–4 shows the code that specifies the label as Select Date and sets the access key to e, the letter immediately after the ampersand character, for the af:outputLabel component. Note: The dvt:hierarchyViewer and dvt:map components do not have built-in accessibility support, and therefore do not have accessibility guidelines. You must provide alternate, accessible access for these components. 22-10 Web User Interface Developers Guide for Oracle Application Development Framework Example 22–4 ValueAndAccessKey Attribute Defined af:outputLabel for=someid valueAndAccessKey=Select Datamp;e af:inputText simple=true id=someid Access key modifiers are browser and platform-specific. If you assign an access key that is already defined as a menu shortcut in the browser, the ADF Faces component access key will take precedence. Refer to your specific browser’s documentation for details. In some browsers, if you use a space as the access key, you must provide the user with the information that Alt+Space or Alt+Spacebar is the access key because there is no way to present a blank space visually in the components label or textual label. For that browser you could provide text in a component tooltip using the shortDesc attribute.

22.3.5 How to Define Localized Labels and Access Keys

Labels and access keys that must be displayed in different languages can be stored in resource bundles where different language versions can be displayed as needed. Using the resource-bundle element in the JSF configuration file available in JSF 1.2, you can make resource bundles available to all the pages in your application without using a f:loadBundle tag in every page. To define localized labels and access keys: 1. Create the resource bundles as simple .properties files to hold each language version of the labels and access keys. For details, see Section 21.3.1, How to Define the Base Resource Bundle.

2. Add a locale-config element to the faces-config.xml file to define the

default and supported locales for your application. For details, see Section 21.3.3, How to Register Locales and Resource Bundles in Your Application.

3. Create a key and value for each string of static text for each resource bundle. The

key is a unique identifier for the string. The value is the string of text in the language for the bundle. In each value, place an ampersand or amp in front of the letter you wish to define as an access key. For example, the following code defines a label and access key for an edit button field in the UIStrings.properties base resource bundle as Edit: srlist.buttonbar.edit=Edit In the Italian language resource bundle, UIStrings_it.properties, the following code provides the translated label and access key as Aggiorna: srlist.buttonbar.edit=Aggiorna 4. Add a resource-bundle element to the faces-config.xml file for your application. Example 22–5 shows an entry in a JSF configuration file for a resource bundle. Example 22–5 Resource Bundle in JSF Configuration File resource-bundle varresvar base-nameresources.UIStringsbase-name resource-bundle