Using aria-haspopup to simulate hover on touch-enabled devices

Hovering your cursor over a webpage element is a common action when browsing with a mouse and keyboard, but there is no equivalent in touch-based browsing. Internet Explorer 10 on Windows 8 introduces a new use for the aria-haspopup Document Object Model (DOM) property: simulating hover on touch-enabled devices.

Note  This behavior is not applicable to Internet Explorer 10 on Windows 7.

A common pattern on the Web is to hide interactive content behind mouse hover. For example, a user can point to an element with a mouse and a menu is shown below it. Hover is typically enabled by using either the :hover Cascading Style Sheets (CSS) pseudo-class or the onmouseover DOM event.

In touch scenarios, hover is applied to an element while it is being touched. However, tapping an element can also activate an element, such as navigating a link. Effectively, a tap is both hover and activation in one action. This makes interactive content hidden behind hover inaccessible for touch users. The interaction model is completely different, and there is no touch analog to hovering the cursor over a page element.

The best practice is to not use hover to hide content that a user can interact with. Instead, consider using the onclick event to toggle the visibility.

Alternatively, Internet Explorer 10 adds new behavior to the existing aria-haspopup property to simulate hover on page elements with hidden interactive content.

On a page element such as a menu, set the element's aria-haspopup property to "true". When an Internet Explorer 10 user on a touch-enabled device first taps the page element, the user's experience will be identical to that of a user who hovers over the element with a cursor. Until the user taps elsewhere on the page, taps the element again, or navigates to another page, the element remains in its hover state. Additionally, default actions of the onclick event (such as navigation of a link) are not performed for the first tap on the page element.

Enabling the aria-haspopup property doesn't change the behavior of your webpage for visitors using a mouse and keyboard. In addition, using the aria-haspopup property for this purpose doesn't affect its use as an Accessible Rich Internet Applications (ARIA) property.

Related topics

DOM
Internet Explorer 10 Guide for Developers

 

 

Show:
© 2014 Microsoft