Android Talkback没有注册onFocus for web。如何使用Android Talkback操纵辅助功能焦点? [英] Android Talkback not registering onFocus for web. How do I manipulate accessibility focus with Android Talkback?

查看:169
本文介绍了Android Talkback没有注册onFocus for web。如何使用Android Talkback操纵辅助功能焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说,Android Talkback没有注册 onFocus 事件。据我所知,由于屏幕阅读器使用特殊类型的 onFocus 事件6798776>辅助功能焦点。那么,我们如何驱动/操纵可访问性焦点以便为用户提供更好的体验?

As the title says, Android Talkback is not registering the onFocus event. I understand that the onFocus event is not ever registered since the screen reader is using a special type of accessibility focus. How, then, can we drive/manipulate the accessibility focus to provide the user a better experience?

我在这里有一个例子: https://codesandbox.io/s/r54j2mqrl4 。所以这里的 console.log(你好!)没有在移动Android Talkback中为我注册,但它在桌面mac OSX上正确注册(没有屏幕阅读器) )。我正在使用tab键进行导航。

I have an example here: https://codesandbox.io/s/r54j2mqrl4 . So here the console.log("hello!") is not registering for me in mobile Android Talkback, however it is registering correctly on desktop mac OSX(with no screen reader on). I am using the tab key to navigate.

是否有类似 onFocus 的事件用于Android Talkback的辅助功能焦点?

Is there something similar to an onFocus event to use for Android Talkback's accessibility focus?

提前感谢您的时间。

设备和版本

移动Android对讲:三星Galaxy Tab S2,Android 7.0版,谷歌浏览器62.0.3202.84

Mobile Android Talkback: Samsung Galaxy Tab S2, Android version 7.0, Google Chrome 62.0.3202.84

桌面Mac OSX:macOS Sierra 10.12.6 ,谷歌浏览器61.0.3163.100

Desktop Mac OSX: macOS Sierra 10.12.6, Google Chrome 61.0.3163.100

推荐答案

.focus()方法理论上应该可行。如果收到焦点的东西也不会获得可访问性焦点,那么问题就会发挥作用。 Android辅助功能服务只能是辅助功能焦点,也是辅助功能的焦点。

The ".focus()" method theoretically should work. The problem would come into play in the event that the thing that was receiving "focus" would not also receive accessibility focus. An Android Accessibility Service can only accessibility focus things that are also Accessibility focusable.

不幸的是,您无法直接从Javascript操作辅助功能焦点,只关注焦点。这就是说,当你在Android中并且某些东西请求焦点时,这通常表明可访问性焦点也会随着焦点移动到该项目。在TalkBack术语中,这是Tab导航的工作方式,Accessibility Focus只是跟随输入焦点。它并不完美,但Focus和Accessibility Focus想要保持一致是合理的期望。虽然并非总是如此:在TalkBack中,EditTexts可以处于quazi聚焦/未聚焦状态,这是有充分理由的......当字段仍有光标(输入焦点)时,您可能需要与屏幕键盘进行交互。

Unfortunately you cannot manipulate Accessibility Focus directly from Javascript, only focus. This being said, when you're in Android and something requests focus, this usually suggests accessibility focus will also move to that item along with focus. In TalkBack terms, this is how Tab navigation works, Accessibility Focus just follows input focus around. It's not perfect, but it's a reasonable expectation that Focus and Accessibility Focus want to be the same. Though not always: EditTexts can be in an quazi focused/unfocused state in TalkBack, for good reason... you may need to interact with the onscreen keyboard while the field still has the cursor (input focus).

如果以下情况属实:


  • 您的元素是可聚焦辅助功能

  • 你的元素是可聚焦的

  • A11yFocusable和可聚焦的东西是相同的,而不仅仅是后代(非常重要)。

您可以通过在Android设备监视器中浏览来轻松确认上述三件事。三重检查你没有关注你所设想的可访问性焦点的东西(比如元素的孩子)。

You can easily confirm the above three things by exploring in Android Device monitor. Triple check that you aren't focusing something (like a child of the element) of the thing that you are envision getting accessibility focus.

如果在那之后你在这个东西上调用了.focus(),并且它不起作用,你基本上发现了你正在使用的webview中的一个错误呈现您的HTML / Javascript内容,并且没有什么可以做的。

If, after that, you call .focus() on the thing, and it doesn't work, you have essentially found a bug in the webview you are using to render your HTML/Javascript content, and no there is nothing you can do about it.

这篇关于Android Talkback没有注册onFocus for web。如何使用Android Talkback操纵辅助功能焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆