feat(VerticalNavigation): improve accessibility #948
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.
π Linked issue
β Type of change
π Description
This PR will enhance the accessibility (#a11y) of the
VerticalNavigation
component by adding the following:ul
li
) for each vertical navigation elementProblem we are solving
The
VerticalNavigation
element in its current state fails the following WCAG success criteria:Use of Color
When the
VerticalNavigation
component determines that a page is "active" (i.e. the current page) it applies styles to the link to signify that the current page is active. This is shown below:This is great UX. However, if you are using a screenreader or assistive technology, you don't "see" these styles and so you miss out on this important information.
Adding hidden text that tells the user they are on the "Current page" addresses this deficiency.
https://www.w3.org/WAI/tutorials/menus/structure/#indicate-the-current-item
Info and Relationships
Visually, and structurally, I would submit that the
VerticalNavigation
component creates a list of links. However, the markup does not demonstrate this structure, as the links are just added to the markup sequentially.By adding HTML list markup
ul
andli
this addresses SC 1.3.1 and enhances the accessibility of the markup.https://www.w3.org/WAI/tutorials/menus/structure/#unordered-list
Potential concern
To identify the current page, I added in a visually hidden text "Current Page:" before the link label. The text is English.
Developers creating websites or web applications that are in a different language would then have English text within their projects. At least the text would be hidden visually, but wouldn't make too much sense in other languages.
Perhaps a future enhancement would be to either have the text user definable, or have some sort of prop mechanism that specifies the languages and then the string is pulled from a lookup table.
Screenshot
π Checklist