以编程方式移动可访问性焦点 [英] Move accessibility focus programmatically

查看:83
本文介绍了以编程方式移动可访问性焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在按下按钮时将可访问性焦点(iOS上的VoiceOver和Android上的Talkback)移动到定义的窗口小部件?

Is it possible to move the accessibility focus (VoiceOver for iOS and Talkback for Android) to a defined widget when pressing a button?

我尝试在语义包,但是我找不到一种方法。

I've tried searching in the Semantics package but I can't find a way to obtain this.

这也足以使屏幕阅读器重新启动语义树。

It would be enough also to make the screen reader restart the semantics tree from the beginning.

我有一个 PageView ,其中包含3个页面和按钮,使用<$可以向后/向前移动c $ c> PageController 。我想使用按钮(调用 _pageController.animateToPage )更改此按钮时,将焦点移到页面的开头。

I have a PageView with 3 pages and buttons to move back/forward using a PageController. I would like to move the focus to the beginning of the page when this changes using the button (that invokes _pageController.animateToPage).

推荐答案

简而言之,不,目前没有允许您通过代码移动可访问性焦点的方法。

In short, no, there currently is no method that allows you to move the accessibility focus through code.

请参考 https://stackoverflow.com/a/28481095/6668797 上的免责声明,以作为背景(尽管Android仍然允许我们执行此操作。.)

Referring to the disclaimer mention at https://stackoverflow.com/a/28481095/6668797 as some background (even though Android still allows us to do this..)


免责声明:将活动负载的重点放在
顶部之外的任何位置bar总是(好吧,几乎永远不应该说),但是
确实是,只是不要这样做。这分别违反了WCAG 2.0
的所有规定,包括3.2.1和3.2.3,分别涉及可预测的
导航和上下文更改。通过执行此操作,您实际上可能
使得您的应用无法访问。

DISCLAIMER: Forcing focus on Activity load to be anywhere but at the top bar is always (okay, always should almost never be said), but really, just don't do it. It is a violation of all sorts of WCAG 2.0 regulations, including 3.2.1 and 3.2.3, regarding predictable navigation and context changes respectively. You are, likely, actually making your app MORE inaccessible by doing this.

http://www.w3.org/TR/WCAG20/#consistent-behavior

Dart团队目前坚定地支持该规则,因此添加此功能并不是一个优先事项。

The Dart team currently stands steadfast behind that rule, so it just hasn't been a priority to add this feature.

如果如果您确实希望通知用户现在可以看到另一个页面,则可以使用 SemanticsService.announce()通知用户一些操作。例如,在 onPageChanged

If you really wish to notify the user that a different page is now visible, you can use SemanticsService.announce() to inform the user after some action. For example, set this in onPageChanged,

onPageChanged: (int page) {
  // announce new page
}

这篇关于以编程方式移动可访问性焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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