Javascript:在 iOS VoiceOver 开启的情况下使用 ontouchstart 捕获滑动手势
Javascript: Capture swipe gesture using ontouchstart with iOS VoiceOver turned on
我们正在开发一款使用左右滑动手势来导航内容的应用程序。对于使用 VoiceOver 屏幕的盲人用户 reader,手势被 VoiceOver 窃取。这是一个问题,因为滑动手势是我们应用程序的主要功能,对盲人用户来说效果很好(但其他一些按钮需要 VoiceOver)。
我们正在 HTML5 javascript 开发 Cordova/PhoneGap。
理想情况下,我们希望禁用 VoiceOver 事件捕获或在某个区域内禁用 VoiceOver(即 DIV)。
Apple iOS 是主要目标,但理想情况下它也会使用 HTML5 ARIA 等标准,因为我们希望它在 Android 上也能与其他屏幕一起工作 readers。
注意:下面提供的解决方案不是最优的,最好提供与手势不同的解决方案。
目前无法以编程方式打开 VoiceOver 手势拦截。唯一的方法是让用户使用 iOS 手势直通。为了启用此功能,您的手势区域必须聚焦并具有 role="application" 属性。
要使用 iOS 手势直通,您 double-tap 并按住一秒钟。 VoiceOver 轮廓将消失,然后可以使用任何拖动或滑动手势(您不能使用任何需要抬起手指的手势,因为这会禁用直通)。
截至我最近使用 iOS 8 进行的测试,应用程序角色是必需的。链接的解决方案适用于所有 iOS 版本,包括最新版本 (9.2)。
您必须通过提供带有说明的屏幕 reader 文本来告知 VoiceOver 用户如何使用通路。
在任何地方保持 4 根手指并用一根手指在可滑动区域上滑动也可以。我在旋转木马上试过了
我们想出了一个解决方法,适用于我们的用例。我已经从我的 Speaking Email blog 中粘贴了有关我们如何实现这一目标的相关部分:
The big problem is that VoiceOver takes over the swipe gestures, and a
fundamental part of our app is what we call the "email slider" where
you navigate emails by swiping left and right.
We managed to solve this by presenting the email slider as an ARIA
"tabset", which is a component that happens to be navigated by swiping
left and right. We named the tabs by the title of the email (eg "Email
from Fred Flintstone") so the user can quickly flip between emails and
hear VoiceOver read out the email title. A couple of seconds after the
user stops changing tabs (ie swiping left and right), we then trigger
our own text-to-speech engine to read out the email content nicely as
usual. So we managed to present a swipe left and right interface using
VoiceOver and WAI ARIA standards.
我们正在开发一款使用左右滑动手势来导航内容的应用程序。对于使用 VoiceOver 屏幕的盲人用户 reader,手势被 VoiceOver 窃取。这是一个问题,因为滑动手势是我们应用程序的主要功能,对盲人用户来说效果很好(但其他一些按钮需要 VoiceOver)。
我们正在 HTML5 javascript 开发 Cordova/PhoneGap。
理想情况下,我们希望禁用 VoiceOver 事件捕获或在某个区域内禁用 VoiceOver(即 DIV)。
Apple iOS 是主要目标,但理想情况下它也会使用 HTML5 ARIA 等标准,因为我们希望它在 Android 上也能与其他屏幕一起工作 readers。
注意:下面提供的解决方案不是最优的,最好提供与手势不同的解决方案。
目前无法以编程方式打开 VoiceOver 手势拦截。唯一的方法是让用户使用 iOS 手势直通。为了启用此功能,您的手势区域必须聚焦并具有 role="application" 属性。
要使用 iOS 手势直通,您 double-tap 并按住一秒钟。 VoiceOver 轮廓将消失,然后可以使用任何拖动或滑动手势(您不能使用任何需要抬起手指的手势,因为这会禁用直通)。
截至我最近使用 iOS 8 进行的测试,应用程序角色是必需的。链接的解决方案适用于所有 iOS 版本,包括最新版本 (9.2)。
您必须通过提供带有说明的屏幕 reader 文本来告知 VoiceOver 用户如何使用通路。
在任何地方保持 4 根手指并用一根手指在可滑动区域上滑动也可以。我在旋转木马上试过了
我们想出了一个解决方法,适用于我们的用例。我已经从我的 Speaking Email blog 中粘贴了有关我们如何实现这一目标的相关部分:
The big problem is that VoiceOver takes over the swipe gestures, and a fundamental part of our app is what we call the "email slider" where you navigate emails by swiping left and right.
We managed to solve this by presenting the email slider as an ARIA "tabset", which is a component that happens to be navigated by swiping left and right. We named the tabs by the title of the email (eg "Email from Fred Flintstone") so the user can quickly flip between emails and hear VoiceOver read out the email title. A couple of seconds after the user stops changing tabs (ie swiping left and right), we then trigger our own text-to-speech engine to read out the email content nicely as usual. So we managed to present a swipe left and right interface using VoiceOver and WAI ARIA standards.