Partilhar via


Accessibility property change events

Starting with Internet Explorer 11, Internet Explorer implements several custom Microsoft Active Accessibility (MSAA) property change events that enable Windows Narrator and other assistive technologies to provide users with notifications for when an auto-correction occurs or Input Method Editor (IME) actions happen.

Although they originate as Microsoft Active Accessibility (MSAA) property change events, they can then be converted to custom Microsoft UI Automation events with the MSAA to UIA Proxy. The events are represented by the following identifiers.

Auto-correction

DEFINE_GUID(
  GUID_TextEdit_TextChangeAutoCorrect_Property,
  0x46a56456, 0x4b6, 0x4a08, 0xa2, 0xbd, 0x9a, 0x76, 0x4f, 0xc5, 0x82, 0x46);
const UIAutomationPropertyInfo TextEdit_TextChangeAutoCorrect_PropertyInfo = 
  { 
    GUID_TextEdit_TextChangeAutoCorrect_Property,
    L"TextEdit_TextChangeAutoCorrect_Property",
    UIAutomationType_String
  };

IME composition change

DEFINE_GUID(
  GUID_TextEdit_TextChangeComposition_Property,
  0xc023b8f, 0xa815, 0x426b, 0xbb, 0x3b, 0x26, 0x57, 0xb9, 0xb9, 0x99, 0xaa);
const UIAutomationPropertyInfo TextEdit_TextChangeComposition_PropertyInfo =
  { 
    GUID_TextEdit_TextChangeComposition_Property,
    L"TextEdit_TextChangeComposition_Property",
    UIAutomationType_String
  };

IME composition finalize

DEFINE_GUID(
  GUID_TextEdit_TextChangeCompositionFinalized_Property,
  0x6ae780c7, 0x579, 0x4659, 0xb0, 0x69, 0x16, 0x50, 0xd0, 0xaf, 0xb1, 0xca);
const UIAutomationPropertyInfo TextEdit_TextChangeCompositionFinalized_PropertyInfo =
  { 
    GUID_TextEdit_TextChangeCompositionFinalized_Property,
    L"TextEdit_TextChangeCompositionFinalized_Property",
    UIAutomationType_String
  };

Because MSAA does not expose as much information as UI Automation, IE implements a callback to provide additional information to Windows Narrator and other assistive technologies. For more details, see Registering Custom Properties, Events, and Control Patterns.

The following code shows how a 3rd party assistive technology might register the auto-correction custom UI Automation property.

DEFINE_GUID(
  GUID_TextEdit_TextChangeAutoCorrect_Property, 
  0x46a56456, 0x4b6, 0x4a08, 0xa2, 0xbd, 0x9a, 0x76, 0x4f, 0xc5, 0x82, 0x46);
HRESULT AddCustomPropertyEventHandler(IUIAutomationElement *pAutomationElement, IUIAutomation *pAutomation, IUIAutomationPropertyChangedEventHandler *pTextEventHandler)
{
    HRESULT hr = S_OK;
    UIAutomationPropertyInfo customPropertyInfo = 
    {
        GUID_TextEdit_TextChangeAutoCorrect_Property,
        L"TextEdit_TextChangeAutoCorrect_Property",
        UIAutomationType_String
    };
 
    CComPtr<IUIAutomationRegistrar> spRegistrar;
    hr = spRegistrar.CoCreateInstance(
      CLSID_CUIAutomationRegistrar, 
      nullptr, 
      CLSCTX_INPROC_SERVER,
      IID_PPV_ARBS(&spRegistrar));
 
    if (SUCCEEDED(hr))
    {
        PROPERTYID customPropertyId;
        hr = spRegistrar->RegisterProperty(&customPropertyInfo, &customPropertyId);
        if (SUCCEEDED(hr))
        {
            hr = pAutomation->AddPropertyChangedEventHandlerNativeArray(
            pAutomationElement,
            TreeScope_Subtree,
            nullptr,
            pTextEventHandler,
            &customPropertyId,
            1);
        }
    }
 
    return hr;
}