简体   繁体   English

如何使可访问性焦点停留在当前片段内

[英]how to make accessibility focus stay inside current fragment

How can I make focus navigation to stay inside the current fragment? 如何使focus navigation停留在current fragment? Or, how can I set focusable to false for a whole fragment or view with its all child view? 或者,如何将整个片段或带有所有子视图的视图的focusable设置为false?

full explanation: 完整说明:

I'm making my Android app accessible. 我正在使我的Android应用程序可访问。

I have this situation: 我有这种情况:

home fragment (A) is being covered by login fragment (B) after clicking on the title "log in". 单击标题“登录”后,登录片段(B)将覆盖家庭片段(A)。 as you can see here: 如您在这里看到的:

fragments diagram 片段图

after click on "log in", login fragment gets focus, and until clicking on back I want the accessibility focus to stay inside the login fragment (when the user navigate through focus navigation) rather then keep jumping between covered elements in fragment A. 单击“登录”后,登录片段将成为焦点,直到单击back我希望accessibility focus停留在登录片段内(当用户通过焦点导航进行导航时),而不是继续在片段A中覆盖的元素之间跳转。

How can I make focus navigation to stay inside fragment B? 如何使焦点导航留在片段B内? Or, instead: 或者,改为:

How can I set focusable to false for the all of the child views in fragment A? 如何为片段A中的所有子视图将focusable设置为false?

thanks! 谢谢!

You need an accessible modal dialog. 您需要一个可访问的模式对话框。 It's a pretty common thing. 这是很普通的事情。 Greg Kraus, the former accessibility guru at NCSU wrote a great blog on this topic - https://github.com/gdkraus/accessible-modal-dialog NCSU的前可访问性专家Greg Kraus在此主题上写了一个很棒的博客-https: //github.com/gdkraus/accessible-modal-dialog

You essentially need to create a big <div> to cover your main window and make the z-order on top of your main window. 本质上,您需要创建一个大的<div>来覆盖您的主窗口并使z顺序位于主窗口的顶部。 This big <div> could have opacity set on it if want the main window to appear disabled. 如果希望主窗口显示为禁用,则此大的<div>可以设置不透明度。 The <div> doesn't accept any input so the user can't move the focus back to the main window. <div>不接受任何输入,因此用户无法将焦点移回主窗口。 Then your login dialog would have a z-order higher than the <div> . 然后,您的登录对话框的z顺序将比<div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM