This article provides an overview of Microsoft Active Accessibility SDK support provided by the MSHTML component of Windows Internet Explorer.
Accessibility aids are applications that help people with disabilities use computers. Active Accessibility enables accessibility aids to communicate with the operating system and other applications through a common interface. The Active Accessibility API supports the integration of accessibility aids with accessibility-aware applications.
There are two types of accessibility aids. One type magnifies information on a screen or provides audio interpretations of text and other visual elements. These accessibility aids benefit users who have limited vision or are blind. The other type includes hardware and software tools that support users who have limited dexterity, enabling them to use different keyboard driver software and alternative input devicesâsomething other than a keyboard or a mouse.
Active Accessibility supports HTML through the MSHTML dynamic-link library that is included with Microsoft Internet Explorer 4.01 and later.
The Windows Software Development Kit (SDK) in the MSDN Online Library contains an overview of Active Accessibility, as well as the complete API reference. This Active Accessibility API reference documents the IAccessible interface and Active Accessibility events, as well as the rest of the Active Accessibility object model. Samples and tutorials are also included in the Microsoft Windows Software Development Kit (SDK).
Prerequisites and RequirementsThis documentation assumes that you are familiar with Microsoft Win32 programming. You should also be familiar with Component Object Model (COM) programming.
To compile C/C++ programs that use the functionality provided by Active Accessibility, be sure that the Oleacc.h header file is in the include directory of your compiler. Because the interface to the accessible objects implements the IDispatch interface, Active Accessibility methods also can be implemented by Microsoft Visual Basic-based applications.
Accessibility Aid BackgroundSupporting Active Accessibility in your applications enables everyone to use your software, including an estimated 50,000,000 users with disabilities.
Before the introduction of Active Accessibility, accessibility aid developers had to use cryptic hook mechanisms or creatively work around the operating system in an attempt to obtain the information they needed. Generally, the developers succeeded, but their applications relied on implementation details that might change with each version of the operating system.
Using COM technology, Active Accessibility provides a way to create high-performance, reliable toolsâenabling applications and accessibility aids to work together in helping users with special needs. Active Accessibility provides a comprehensive object model that includes the interfaces, libraries, and other elements that eliminate the need for unreliable workarounds.
Active Accessibility in Internet Explorer 4.01 and LaterThe MSHTML component in Internet Explorer 4.01 supports the Microsoft Active Accessibility Proxy for HTML, or HTML Proxy. The HTML Proxy communicates with MSHTML through object model interfaces and events to provide an accessible representation of the content of a webpage.
The MSHTML component in Microsoft Internet Explorer 5 and later exposes a native implementation of Active Accessibility, replacing the HTML Proxy. Native implementation of Active Accessibility has resulted in significant performance gains, particularly with larger webpages. This implementation is also more robust when compared with the HTML Proxy implementation. Internet Explorer 5 and later provides these gains in performance and stability.
Accessible HTML ElementsApplications support Active Accessibility by exposing their user interface (UI) elements to client applications. These UI elements are presented to client applications in the form of accessible objects. Accessible objects maintain pieces of information, called properties, that describe the object's appearance, nature, and purpose. The IAccessible interface extends methods that enable an accessibility aid client to retrieve these properties. Using the information that these properties provide, accessibility aids can obtain information valuable to the user, and can convey it to the user as needed. MSHTML supports Active Accessibility by exposing HTML elements to client accessibility aids.
Some HTML elementsâimages, text, and linksâare accessible, and some are not. Being accessible means that each instance of that element in an HTML document has an accessible representation of its own in the document's accessibility hierarchy.
Making Nonaccessible Elements AccessibleElements that are not accessible are ignored and excluded from the document's accessibility hierarchy. These elements are treated as breaking points for the text stream that represents the data in the HTML document. They are treated as children of the element that contains them.
By themselves, accessible elements do not provide a complete solution to authoring accessible webpages. With Internet Explorer 5, any element that has a tabIndex property with a value greater than zero can be considered accessible. Microsoft Internet Explorer 5.01 and later extends this functionality. If the tabIndex property is set, regardless of its value, the element will be included in the accessibility hierarchy.
MSHTML allows the user to press the TAB key to move to elements on the page that can receive focus. MSHTML sends out the appropriate EVENT_OBJECT_FOCUS event. An Active Accessibility client can use AccessibleObjectFromEvent to get information about the child element that was focused.
Accessibility BehaviorsWhen an accessible object is requested for an element, if the element has an element behavior, the application first checks to determine whether the behavior has implemented accessibility support. If the behavior has accessibility support, accessibility queries are delegated to the behavior. However, when the behavior returns an error code this is sent to the client. If the behavior returns an E_NOTIMPL error code Active Accessibility tries to substitute another element.
Accessible HTML EventsMSHTML fires certain accessibility events as a result of object model events. The following table shows these events and their corresponding Active Accessibility counterparts.
If an accessibility client starts after MSHTML has started, these events enable the client to connect to the Active Accessibility implementation for MSHTML and start exposing content. Each event contains a window handle and a reference value, indicating the window and the element in the window for which the event is being fired. For the window itself, the unique identifier is zero. For all other elements, the reference contains the element's unique identifier, even though all events contained the same window handle when they fired. Later, the client application calls back to the Active Accessibility system components with the window handle and the reference number. Active Accessibility then communicates the unique identifier of that element to the MSHTML implementation.
Accessible Objects and Child Elements in an HTML DocumentMSHTML is the component of Internet Explorer that parses an HTML file and renders the webpage to the user's display. In addition to exposing the object model that represents the HTML elements on a webpage, MSHTML exposes accessible objects through the Active Accessibility IAccessible interface.
This section discusses the relationship between HTML elements and their respective accessible objects.
Accessibility HierarchyThe MSHTML component of Internet Explorer exposes accessible HTML elements as a hierarchy of accessible objects. Each accessible object implements the IAccessible interface and provides information about itself and its child elements. The following conditions determine the accessibility hierarchy exposed by MSHTML.
The following HTML example shows how nonaccessible HTML elements determine the way in which contained text is used to create child elements.
<html><body>Here is some <strong>bold text</strong></body></html>
The strong element is a nonaccessible element and is used to distinguish a portion of the text. The resulting accessibility hierarchy consists of an accessible object representing the body element and two child elements. The accessibility hierarchy is as follows.
body (accessible object)
+ "Here is some " (child element)
+ "bold text" (child element)
Accessible Object Properties
Each accessible object provides additional information through descriptive properties, as defined by the IAccessible interface. The value of some of these properties depends on the attributes used in the HTML element or user selection and focus. The property, returned from the IAccessible::get_accRole method, describes the user interface role of an accessible object. The following table lists the values returned by MSHTML for each HTML element.
For more information about descriptive properties and the role constants, see the Microsoft Active Accessibility SDK documentation.
Note To explore the available values of descriptive properties for each element, use the Internet Explorer tool provided with the Active Accessibility Software development kit (SDK).
Hierarchical NavigationAn accessibility aid can navigate the MSHTML accessibility hierarchy by calling the IAccessible::get_accParent, IAccessible::get_accChild, and IAccessible::get_accChildCount methods. For tools and samples that navigate an accessibility hierarchy, see the Microsoft Active Accessibility SDK.
Note MSHTML does not currently implement the IEnumVariant as an alternative way of accessing collections of accessible objects.
Logical NavigationApplications can use Active Accessibility to move the user focus between accessible objects in response to user actions. For example, an accessibility aid might enable the user to tab between controls by using an input device. An accessibility aid navigates between accessible objects by calling the IAccessible::accNavigate method. MSHTML supports the following navigation constants.
NAVDIR_FIRSTCHILD Navigate to the first child of this accessible object. NAVDIR_LASTCHILD Navigate to the last child of this accessible object. NAVDIR_NEXT Navigate to the next accessible object. NAVDIR_PREVIOUS Navigate to the previous accessible object. Hit TestingApplications can use Active Accessibility to identify the accessible objects and child elements at a given screen location. For example, an accessibility aid can improve visibility by magnifying the area under the cursor. There are two approaches to this technique, which is known as hit testing:
Call AccessibleObjectFromPoint to obtain an IAccessible interface for the lowest-level accessible object at a given point.
Call IAccessible::accHitTest to test whether an accessible object or child element is hit. The following identifiers are returned by the MSHTML implementation of IAccessible::accHitTest.
VT_I4 CHILD_SELF Within the accessible object, but not within any child element or accessible object. VT_I4 ID of child Within a child element. VT_DISPATCH IDispatch interface of accessible object Within a child accessible object. VT_EMPTY None Outside the accessible object.The IAccessible::accHitTest method should be called on each child object interface pointer that is returned until CHILD_SELF or a child identifier is returned. If the identifier is a value of CHILD_SELF, the accessible object was hit; otherwise, a child element specified by the child identifier was hit.
Step 1:
Acquire an IAccessible pointer to an element within the page or the accessible window of the document. For example, get the IAccessible interface of any object coming from the window class named "Internet Explorer_Server".
Step 2:
Get an IServiceProvider interface pointer for the accessible object you obtained.
HRESULT hr;
hr = pAcc->QueryInterface(IID_IServiceProvider, (void **)&pSP);
Step 3:
The object obtained by steps 1 and 2 can be an element or a window. In either case, use the following code to access an Internet Explorer object model object.
HRESULT hr;
IHTMLWindow2 * pWindow;
IHTMLElement * pElement;
hr = pSP->QueryService(IID_IHTMLWindow2, IID_IHTMLWindow2,
(void **)&pWindow);
if (FAILED(hr))
hr = pSP->QueryService(IID_IHTMLElement, IID_IHTMLElement,
(void **)&pElement);
// Release the Service Provider interface pointer.
pSP->Release();
if (SUCCEEDED(hr))
{
// Either a window or an element pointer was returned.
assert( pWindow || pElement);
....
code here...
// Release the pointers.
if (pElement)
pElement->Release();
if (pWindow)
pWindow->Release();
}
In the preceding sample, the IServiceProvider::QueryService calls use the same IID values for the service GUID (first parameter) and the interface IID (second parameter). If IServiceProvider::QueryService returns a window and there is an IID_IHTMLWindow2, process the IID as a QueryInterface call to the window. You can request whatever interface you want in the IID. If the object implements the interface, you will obtain a pointer. The first GUID is used to filter objects so that the caller can determine what kind of object was obtainedâan element or a window. This direct delegation saves the application time. If the application has already checked the role property on the IAccessible and found it to be a window object that requires an IUnknown or IHTMLWindow3, not an IHTMLWindow2, the call should pass IID_IUnknown or IID_IHTMLWindow3 as the second parameter.
Performance TipsYou can use the following suggested tips to improve performance in your accessibility aid:
In Microsoft Internet Explorer 6 and later, the pvarState parameter of the IAccessible::get_accState property receives SYSTEM_STATE_OFFSCREEN when an object is invisible because of scrolling.
Microsoft Active Accessibility
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4