Sage / carbon

Carbon by Sage | ReactJS UI Component Library
https://carbon.sage.com
Apache License 2.0
277 stars 86 forks source link

ActionPopover Accessibility Issue #6403

Closed IrynaD26 closed 3 weeks ago

IrynaD26 commented 11 months ago

Current behaviour

ActionPopover causes the following accessibility issue: "All page content should be contained by landmarks". More info about the issue: https://dequeuniversity.com/rules/axe/4.8/region?application=AxeChrome

This probably happens because ActionPopover appends div with the menu to body. So the menu and its items are not within landmarks.

To Reproduce

  1. Click the menu button
  2. Run Axe Tools (ensure best practice is switched on for Axe)
  3. Observe the following error: "All page content should be contained by landmarks" (Axe Tools show errors for the entire page in the sandbox. So you need to click arrows in Axe Tools to get to the div which wraps ActionPopover )

NOTE: This accessibility issue occurs even if ActionPopover is within main or some other landmark. That's because the action popover menu is always in the div which is appended to body.

https://github.com/Sage/carbon/assets/148762678/d2b8f4ed-2168-4103-9853-ab2082e5d760

Expected behaviour

No Axe issue "All page content should be contained by landmarks" for ActionPopover

CodeSandbox or Storybook URL

https://codesandbox.io/s/compassionate-currying-xqh4vy?file=/src/App.js:175-603

JIRA Ticket (Sage Only)

SBS-74832

Suggested Solution

Possible solutions:

  1. not to render the action popover menu in body(maybe add some prop for that)
  2. use role="region" and appropriate aria-label for the div which wraps the action popover menu (not sure if it's a good solution though)

Carbon Version

120.6.1

Design Tokens Version

4.25.0

What browsers are you seeing the problem on?

Chrome

What Operating System are you seeing the problem on?

MacOS

Anything else we should know?

Axe Tools may not show this error if there are other accessibility issues. So if you are trying to reproduce this issue in some other place (not CodeSandbox) and can't reproduce it, try fixing other accessibility issues.

Confidentiality

Parsium commented 11 months ago

FE-6268