Skip to content

MudFocusTrap: Don't hide focusable elements from accessibility tree#9095

Merged
henon merged 1 commit intoMudBlazor:devfrom
danielchalmers:focus-trap-aria-hidden
Jun 3, 2024
Merged

MudFocusTrap: Don't hide focusable elements from accessibility tree#9095
henon merged 1 commit intoMudBlazor:devfrom
danielchalmers:focus-trap-aria-hidden

Conversation

@danielchalmers
Copy link
Member

Description

Reverts parts of #9007

The problem is: Removing a focusable element like a link from the accessibility tree does not remove it from tab order. A screen reader user tabbing through the website will arrive at the link and hear “empty” or something similar. Please, don't do this!

Going to err on the side of caution because it's easy to make accessibility worse unintentionally.

https://oidaisdes.org/common-aria-mistakes.en/

How Has This Been Tested?

visually

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

Reverts parts of MudBlazor#9007

> The problem is: Removing a focusable element like a link from the accessibility tree does not remove it from tab order. A screen reader user tabbing through the website will arrive at the link and hear “empty” or something similar. Please, don't do this!

Going to err on the side of caution because it's easy to make accessibility worse unintentionally.

https://oidaisdes.org/common-aria-mistakes.en/
@danielchalmers danielchalmers added the accessibility Accessibility concerns (ARIA, keyboard, focus, screen readers, contrast) label May 31, 2024
@github-actions github-actions bot added bug Unexpected behavior or functionality not working as intended PR: needs review labels May 31, 2024
@danielchalmers
Copy link
Member Author

@igotinfected Another revision on previous changes. I don't think you should hide elements from the accessibility tree if they can be focused.

@codecov
Copy link

codecov bot commented May 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.60%. Comparing base (28bc599) to head (dfe9d9b).
Report is 245 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #9095      +/-   ##
==========================================
+ Coverage   89.82%   90.60%   +0.77%     
==========================================
  Files         412      398      -14     
  Lines       11878    12382     +504     
  Branches     2364     2406      +42     
==========================================
+ Hits        10670    11219     +549     
+ Misses        681      623      -58     
- Partials      527      540      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@igotinfected
Copy link
Member

@igotinfected Another revision on previous changes. I don't think you should hide elements from the accessibility tree if they can be focused.

Not too knowledgeable about this one -- I find it odd that you can focus the focus trap itself rather than whatever is contained within it (I'm guessing the focus jumps to something more logical when you do though), though to me it does make sense not to aria hide something that is focusable, so in that sense, LGTM!

@danielchalmers danielchalmers requested a review from henon June 1, 2024 17:04
@danielchalmers
Copy link
Member Author

@henon Ready

@henon henon merged commit 9072b07 into MudBlazor:dev Jun 3, 2024
@henon
Copy link
Contributor

henon commented Jun 3, 2024

Thanks Daniel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Accessibility concerns (ARIA, keyboard, focus, screen readers, contrast) bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants