Hit Testing

This topic describes hit testing as it applies to the Accessibility API.

Hit testing works from top to bottom. Because a window must have a pane as its only child, hit testing for a window always returns a pane (BODY or FRAMESET tags). For hit testing, the pane is like any other element:

  • The element that is called checks whether the hit was on content or on white space outside the content area.
  • If the hit was on white space outside the content area, or if the element cannot have any children and it contains the hit in the content area, it returns itself as the hit result.
  • If the hit was on a child of the element, that child is returned.
  • If the child is another element that can have an IAccessible implementation, a pointer to that implementation is returned.
  • If the child is text or is not an element that can have an IAccessible implementation, hit testing returns the index that represents the child. This return indicates that the client should use the child index value to query the current element for more information about the child.
  • If an element receives an accHitTest call and does not contain the point that is being hit tested, hit testing returns a success code with a VT_EMPTY to represent the child that was hit.