fix: use nav elements with descriptive aria-labels #3341
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR sets out to make 2 related improvements to the navigation of the site. Please let me know what you think -- thank you!
1. Ensure that all navigation components use a
<nav>
elementI noticed that docs page has a secondary navigation wrapped in an
<aside>
.In this case I believe it would be more helpful to use
<nav>
to more directly signal the purpose of the markup, as it includes navigation links (reference:<nav>
: The Navigation Section element via MDN). By comparison, an<aside>
element is associated with complementary content "indirectly related to the document's main content" (reference:<aside>
: The Aside element via MDN).2. Ensure that all
<nav>
elements have descriptivearia-label
attributesThere are instances where multiple
<nav>
s appear on a page, as is the case with the newly-revised Docs page and the current News page.Whenever there are multiple
<nav>
, it helps to either point to an existing label (viaaria-labelledby
) or create a label (viaaria-label
). For this PR, I opted to usearia-label
because I did not see any existing headings that would be ideal to point to witharia-labelledby
. Related resource: WCAG 2.1 -- Example usingaria-label
to distinguish between navigation landmarks