GET_ARIA_ERROR_ATTRIBUTES Function

This function is useful for item plug-in developers, to enhance screen reader usability of your item, specifically when that item is associated with an error on a page. This function is called as part of rendering of the item, where the main form element(s) are output. The returned WAI-ARIA attributes include:

  • aria-invalid="true" - Indicates the page item's current value is invalid. When the user is focused on the page item, the screen reader announces 'Invalid Entry' .

  • aria-describedby="[page_item_name]_error" - This attribute value matches up with the ID of a <div> tag containing the item's associated error message, enabling a screen reader to announce the actual error, when the user is focused on the page item.

Note:

Because these attributes only enhance screen reader usability, attributes are returned only if the current session is running in Screen Reader mode.

Syntax

function get_aria_error_attributes (
    p_item_name     in varchar2 )
    return varchar2;

Parameters

Table 8-9 describes the parameters available in the GET_ARIA_ERROR_ATTRIBUTES function.


Table 8-8 GET_ARIA_ERROR_ATTRIBUTES Function Parameters

Parameter Description

p_item_name

The page item name. This value is available by using the name attribute of the apex_plugin.t_page_item record type, which is passed in as the 1st parameter to all item plug-in's Render Function Callback.


Example

This example shows how this function can be used, in rendering a SELECT element, during processing of the Render Function callback for an item plug-in. This function returns additional attributes, if the page item has errors associated with it and if the user is running in Screen Reader mode.

...
        l_name := apex_plugin.get_input_name_for_page_item(false);
        sys.htp.prn('<select name="'" id="'||p_item.name||'" '||
                    apex_error.get_aria_error_attributes(p_item.name)||'>'); 
...