reactjs/react-modal

Accessibility issues with the codepen demos

Open

#955 建立於 2022年6月21日

在 GitHub 查看
 (7 留言) (0 反應) (0 負責人)JavaScript (7,294 star) (828 fork)batch import
documentationexamplesgood first issue

描述

Summary:

Many of the demos linked to from the README have accessibility issues:

  • Minimal example - once the modal is opened, aria-hidden="true" is set on the <body>. this also hides the modal itself (which is a child element of the <body>) from screen readers; when the modal is closed, focus is not returned explicitly to the "Trigger modal" button
  • Using setAppElement - same issues as the minimal example
  • Using inline styles - when the modal is closed, focus is not returned explicitly to the "Trigger modal" button
  • Customizing the default styles - while the #1 modal is fine, when triggering #2 modal the <body> is once again hidden with aria-hidden="true" and, as a result, the #2 modal is also hidden from screen readers

Steps to reproduce:

  1. Use a screen reader
  2. Open the codepen demos
  3. Open/close the various modals

Expected behavior:

  • don't set aria-hidden="true" on the <body> itself, as this will hide everything from screen readers, including the dialog
  • make sure that focus is returned to the button that first opened the modal

Review how the working demos like Using inline styles do it, and apply the same behavior to the broken demos.

貢獻者指南