Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessible Navigation for Nested nav-items #4804

Closed
4 tasks done
mnazzaro opened this issue Dec 27, 2022 · 4 comments
Closed
4 tasks done

Accessible Navigation for Nested nav-items #4804

mnazzaro opened this issue Dec 27, 2022 · 4 comments
Labels
change request Issue requests a new feature or improvement resolved Issue is resolved, yet unreleased if open

Comments

@mnazzaro
Copy link

mnazzaro commented Dec 27, 2022

Contribution guidelines

I want to suggest an idea and checked that ...

  • ... to my best knowledge, my idea wouldn't break something for other users
  • ... the documentation does not mention anything about my idea
  • ... there are no open or closed issues that are related to my idea

Description

I propose adding tabindex, aria-hidden, and aria-expanded attributes to the labels on nested nav-items. I would also like to add event listeners to those same labels such that when they are in focus the user can click enter to expand them.

Use Cases

This would make the nav bar easier to use for visually impaired users. As it stands, they aren't tabbable, and just adding tabindex="0" doesn't make it better because they still need to be clicked on to expand. This is why the event listeners are also necessary.

Screenshots / Mockups

Here's a link to my suggested solution: https://github.com/mnazzaro/mkdocs-material

It still has some problems, though, as described in my comment in discussion 3156: #3156 (reply in thread)

No response

@squidfunk squidfunk added the change request Issue requests a new feature or improvement label Dec 27, 2022
@squidfunk
Copy link
Owner

Thanks for suggesting – great idea! Improving accessibility is always a top priority for this project. We'll tackle this as soon as Material for MkDocs 9 is out (see #4714). Happy to iterate.

@lee0c
Copy link

lee0c commented Jan 3, 2023

Thank you @mnazzaro ! I just ran across this in another project and am so glad to see someone else already working on it!

@squidfunk
Copy link
Owner

Fixed in f8f44f5. Thanks for the PR! However, as mentioned, adding this as inline JavaScript will increase overall page size. Thus, I've inlined the JavaScript and adjusted it a bit. I've not added aria-hidden, as it is implied by aria-expanded, and it should not be removed from the accessibility tree when it is collapsed.

The aria-expanded attribute is set on an element to indicate if a control is expanded or collapsed, and whether or not its child elements are displayed or hidden.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Jan 8, 2023
@squidfunk
Copy link
Owner

Released as part of 9.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change request Issue requests a new feature or improvement resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

3 participants