IE10-IE11 中 IE Touch 的双击错误(链接必须点击两次)

Double Tap Bug on IE Touch in IE10-IE11 (links must be tapped twice)

我在 IE11 Mobile (Lumia 520 Phone) 的现有导航菜单上遇到了这个问题,我的子菜单中的每个 link 在第一次点击时都没有触发点击。

这个fiddle repro is a partial flyout accessible navigation menu, taken from a sample WAI app menu.

如果您在 IE10 或 IE11 Mobile 或 Touch 上测试它,您会发现 none 的子菜单 link 有效。

它们必须被点击两次才能触发点击事件。

这是为什么?

此错误是 "help simulate hover on touch-enabled devices" 从 IE10-11 开始为 Touch 部署的功能的结果。

简而言之,导致并需要双击的原因是将 aria-haspopup=true 作为子菜单父元素级别。因此,IE Touch 错误地假定所有这些链接都是自动切换的,并以此对待它们。我还要指出,出于类似的原因,iOS Safari 有自己的方式来处理

如 MSDN Internet Explorer 10 Samples and Tutorials 中所述:

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

问题在于,虽然它被认为是有用的,但该实现是基于对 aria-haspopup 是什么以及它应该做什么的不完整且有些误导的阅读。

  1. aria-haspopup is technically a property (and not state). Meaning that IE placed a touch behavior on an element that isn’t supposed to change at runtime. Unless a responsive context would perhaps require such a change; aria-haspopup='true' shall remain true even if the popup element is shown. The state for the switch being aria-expanded 代替。

  2. 这个概念只适用于 MSDN example of aria-haspopup as implemented on that tutorial. i.e. If aria-haspopup=true is placed on the toggle button itself, that IE Touch feature will work as intended. However if the aria-haspopup=true attributes is placed at the parent level like my repro, or like a more traditional app menu, as per this W3C/WAI example,这是个问题。

解决此错误的解决方案是,由于 IE10-11 Touch(可访问性很差),不在父元素上使用 aria-haspopup=true,或者将其从启用的触摸中移除 IE10/IE11 ,在服务器端或相应地使用 Javascript。