Is there a rule for Web accessibility as to when a

2019-07-19 11:56发布

问题:

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.