Is there a rule for Web accessibility as to when an overlay / modal dialog is open, whether any element should be the focus?

天大地大妈咪最大 提交于 2019-12-11 02:31:14

问题


I have seen several behaviors:

  1. No element is focused.
  2. The close icon (usually at top right of overlay) is focused.
  3. Some other element inside of the overlay is focused.

If conforming to ADA / ARIA standards, should any element be in focus?


回答1:


The current recommend behavior is to focus the first focusable element in the dialog. However, there has been some debate on that implementation recently as it poses problems for users who use screen magnification software and screen readers.

in cases where the focus on display moves to a control at the bottom of the dialog a few negative things happen:

  1. For a screen magnifier user the focus moves to the control, due to the viewport containing only a small portion of the dialog content (typical magnifcation 400-600%) only the bottom part of the content is viewed, unlike the top of the dialog, the bottom content offers no context. users have to navigate around to get an idea of what is going on.
  2. For an SR user (such as JAWS) only the content of the focused element is announced, users have to navigate around the content to get an idea of what is going on.

The debate doesn't appear to be settled, but consensus is growing towards a new recommendation:

  1. If any element in the dialog has the autofocus element, focus that element.
  2. Otherwise focus the dialog itself using tabindex=-1 and outline: none.

Focusing the dialog element itself allows screen readers to read the contents of the dialog to the user, giving them context right away, and a screen magnifier will start at the top left corner of the dialog so they can start reading it from the beginning.



来源:https://stackoverflow.com/questions/44467777/is-there-a-rule-for-web-accessibility-as-to-when-an-overlay-modal-dialog-is-op

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!