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

Improve accessibility (a11y) for screen-readers #70

Merged
merged 3 commits into from
Sep 1, 2020
Merged

Improve accessibility (a11y) for screen-readers #70

merged 3 commits into from
Sep 1, 2020

Conversation

seshrs
Copy link
Member

@seshrs seshrs commented Aug 31, 2020

I did not have accessibility in mind when working on Primer Spec so far. For the v1.4 release, I'd like to include some improvements for students who use a screen-reader (or tab their way through the spec).

Visually, Primer Spec should look unchanged. However, this PR makes the following changes that affect screen-readers:

  • Place the Topbar before the Main Content and the Sidebar to ensure correct focus-order using tabbing or a screen-reader.
  • Replace many top-level <div> elements with semantic HTML tagnames. Specifically, the Sidebar is contained in an <aside> element, the Table Of Contents is a <nav> within the <aside>, the Main Content is a <main>, and the Topbar is a <header>. These tags help screen-readers identify landmarks on the page.
  • Convert the Table of Contents to a nested list of unordered-lists (to semantically indicate its structure to screen-readers).
  • Use ARIA labels to clarify the purpose of toggle buttons. (Also, the sidebar-toggle button is now correctly hidden when the Sidebar is shown.)
  • Make the Sidebar's border non-focusable (since it doesn't make sense to focus on it anyway).

I verified these changes by learning to use my Mac's built-in screen-reader (VoiceOver). I also used the tab key without a screen-reader to verify a11y for keyboard-users.

This commit introduces the following changes for accessibility (a11y):
- The Topbar is placed before the Main Content and the Sidebar. This is necessary for correct focus-order using tabbing or a screen-reader.
- Many divs are replaced by semantic HTML tagnames. Specifically, the Sidebar is an <aside> element, the TableOfContents is a <nav> within the <aside>, the Main Content is a <main>, and the Topbar is a <header>. These landmarks help screen-readers identify these landmarks on the page.
- The toggle buttons now have ARIA labels to help clarify their purpose. (Also, the sidebar-toggle button is now correctly hidden when the Sidebar is shown.)
- The Sidebar's border is now not focusable (since it doesn't make sense to focus on it anyway).
Semantically, this indicates that the table of contents is structured as a nested list of items and sections.
@seshrs seshrs added enhancement New feature or request semver/minor Pull Request proposes "minor" change labels Aug 31, 2020
@seshrs seshrs added this to the WN 2021 milestone Aug 31, 2020
@seshrs seshrs merged commit 3a2f01c into develop Sep 1, 2020
@seshrs seshrs deleted the a11y branch September 1, 2020 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver/minor Pull Request proposes "minor" change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant