在 ember 中将屏幕阅读器的焦点设置在模态警报上 [英] Setting focus of a screen reader on a modal alert in ember

查看:41
本文介绍了在 ember 中将屏幕阅读器的焦点设置在模态警报上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使我的 ember.js 应用程序更易于访问,并且正在通过 Apple 的内置 VoiceOver 实用程序进行测试.我正在根据需要添加 ariaRoles- 导航目的不明确的标签属性.我在关注模态警报时遇到了问题,因为读者的注意力集中在模态后面的页面项目上.有没有人有处理屏幕阅读器模式警报的经验?我的印象是,在我的视图中声明ariaRole:'alertDialog'"会为此类对话框设置适当的角色,并且此角色的焦点行为可能因屏幕阅读器而异.谢谢!!!

解决方案

我对模态的东西没有第一手经验.从本质上讲,您的问题是您正在扮演 ARIA 角色,并希望它能奏效.你需要做的不止这些.您需要牢记以下几点:

  • 按下链接/按钮后,将焦点移至模式窗口/对话框/弹出窗口.大多数模态元素只是一个

    .你可以给

    一个tabindex="-1"的属性.
  • 在模态窗口内捕获焦点.
  • 允许用户按退出键关闭
  • 关闭时,将焦点移回链接/按钮

资源

I am attempting to make my ember.js app more accessible and am doing my testing via Apple's built-in VoiceOver utility. I'm adding ariaRoles as necessary to my views and tacking on aria-label attributes where the purpose of navigation is unclear. I'm having issues getting the focus on modal alerts, as the reader's focus stays on the page items behind the modal. Does anyone have experience handling focus on modal alerts for screen readers? I'm under the impression that declaring "ariaRole:'alertDialog'" in my view sets the appropriate role for such a dialog, and it is possible that the focus behavior for this role differs between screen readers. Thanks!!!

解决方案

I don't have first hand experience with modal stuff. Essentially your issue is you are throwing on an ARIA role, and kind of expect it to work. You need to do more than that. You need to keep the following in mind:

  • Once the link/button is pressed, move focus to the modal window/dialog/popup. Most modal elements are simply a <div>. You can give the<div> an attribute of tabindex="-1".
  • Trap focus inside the modal window.
  • Allow the user to press escape to close
  • When closed, move focus back to link/button

Resources

这篇关于在 ember 中将屏幕阅读器的焦点设置在模态警报上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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