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

WCAG Compliance #566

Open
dking-after opened this issue Feb 11, 2021 · 3 comments
Open

WCAG Compliance #566

dking-after opened this issue Feb 11, 2021 · 3 comments

Comments

@dking-after
Copy link

I'm finding this theme to be very capable. However, one thing that presents an issue is that the built-in styling generates errors when evaluating for WCAG compliance (you can analyze the Just the Docs pages with something like the WAVE plugin for a quick read). With WACG 2.2 coming out later in 2021, there will probably be renewed attention to accessibility issues and, for larger organizations in many countries, compliance with 2.1 is already mandated.

Overall, the default style has a lot of positives: structural elements are strong, keyboard nav works, etc. The chief area for improvement seems to be contrast. It shows up in several areas, including code blocks, labels, buttons.

Obviously, I can (and will) modify SCSS to address this on my site, but it might be worth looking at tweaking the default variables and elements to be WCAG-friendly out of the box. That way Just the Docs users create more accessible sites without having to be well-versed in standards.

Thanks for considering this.

@mattxwang
Copy link
Member

Just circling back to this - now that maintenance is more active, I do want to really emphasize our approach to accessibility. Going to pin this issue - would love to have more people chime in!

(I'm happy to work on this, and in particular tweak our defaults; would like more maintainer input, particularly from those with backgrounds in design)

@JPrevost
Copy link
Contributor

In addition to the contrast issue, which as noted are relatively easily solvable, I've currently noted two additional issues I think would be great to see addressed (and I'm not opposed to putting engineering resources into resolving them if the maintainers are interested).

  • The svg images in the navigation to signify collapsing the links to sub pages don't have text readable by screenreader but are also not removed from being tabbed to which means users tab to a link with no text and they have to either skip it or guess what it will do. I believe this is fixable by adding a title element to the svg element similar to:
<svg viewBox="0 0 24 24" title="toggle links in {{ node.title }} category">
  <use xlink:href="#svg-arrow-right"></use>
</svg>

The specific wording is my example is bit awkward, but something like that is one possible way to resolve that. (svg title is just one option and others could be considered if that isn't desired. It seemed the easiest way to address this with my limited knowledge of the code base.

  • Tab order in general is problematic for screen readers. You have to tab through all of the navigation to get to the main content of a page. Once you select a page, you need to tab through it all again. The best way to resolve this might be to have the content order be the desired tab order... which means a significant change to the main layout file (i.e. moving the navigation in the html after the main content is likely a better dom order but that would require both moving the html blocks and updating css and/or introducing a breaking change to the theme by changing where navigation shows up. There may be simpler ways to address this by including a "jump to main content" link as described here which would be much less work (I haven't confirmed it would fully address the tab order issues I've noted but would be much less intrusive if it works).

If the maintainers would be interested in working through these issues together, I'd be happy to provide Pull Requests to discuss options further over code.

@mattxwang
Copy link
Member

mattxwang commented Sep 2, 2022

Hi @JPrevost, thanks for making your comment! I agree that these are both things we should resolve. I would certainly be open for a PR for either!

Re: svg titles, My understanding is that the <title> element should be used instead of the title attribute (I don't see that as part of the SVG element spec).

Re: tab order, I'll have to think about it a bit more, but an exploratory PR is a great idea!

JPrevost added a commit to JPrevost/just-the-docs that referenced this issue Sep 2, 2022
Why are these changes being introduced:

* The current links to show/hide the nested pages use a visual only
  svg image with no accessible affordance provided so screenreaders
  will not be able to provide appropriate context for users as to what
  they should expect when clicking these links
* You can see the problem by running a tool like ANDI on the current
  main branch of this repository and then running it again on this
  branch. ANDI shows what a screenreader would read.
* You can also use a tool like Voiceover to hear the importance of what
  this introduces to users that use that technology. Before this change,
  Voiceover would read all of these navigation links as
  "link image just-the-docs" but with this change it will read
  `link image toggle links in <categoryName> category`

Relevant ticket(s):

* This was discussed as part of the larger WCAG compliance ticket
  just-the-docs#566

How does this address that need:

* This adds an `aria-label` to the link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label

Document any side effects to this change:

It appears it might be prefereable to use `aria-labelledby` whenever
possible, but from what I can tell these links are just the visual cue
of the svg with no other affordance given to users to understand what
they'll do so there is nothing to point `aria-labelledby` at.

An `svg` title was considered, but in reading more about it it seemed
like `aria-label` was more appropriate as it puts the label on the `a`
rather than the `svg` which feels more accurate.

* https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby
JPrevost added a commit to JPrevost/just-the-docs that referenced this issue Sep 2, 2022
Why are these changes being introduced:

* The current tab order requires keyboard or screenreader users to tab
  though all of the navigation links before they get to the main content
  of the page

Relevant ticket(s):

* Discussed as part of larger WCAG ticket just-the-docs#566

How does this address that need:

* Introduces an off screen link as the first element in the tab order
  that will display when it has focus but remain off screen for users
  not using tab to navigate the document.
* Introduces a new scss file with the required style elements and uses
  colors variables to ensure both light and dark mode are respected.

Background information on this technique:

- https://www.w3.org/TR/WCAG20-TECHS/G1.html
- https://accessibility.oit.ncsu.edu/it-accessibility-at-nc-state/developers/accessibility-handbook/mouse-and-keyboard-events/skip-to-main-content/
mattxwang added a commit that referenced this issue Sep 6, 2022
Adds accessible nav elements for nested pages

Why are these changes being introduced:

* The current links to show/hide the nested pages use a visual only
  svg image with no accessible affordance provided so screenreaders
  will not be able to provide appropriate context for users as to what
  they should expect when clicking these links
* You can see the problem by running a tool like ANDI on the current
  main branch of this repository and then running it again on this
  branch. ANDI shows what a screenreader would read.
* You can also use a tool like Voiceover to hear the importance of what
  this introduces to users that use that technology. Before this change,
  Voiceover would read all of these navigation links as
  "link image just-the-docs" but with this change it will read
  `link image toggle links in <categoryName> category`

Relevant ticket(s):

* This was discussed as part of the larger WCAG compliance ticket
  #566

How does this address that need:

* This adds an `aria-label` to the link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label

Document any side effects to this change:

It appears it might be prefereable to use `aria-labelledby` whenever
possible, but from what I can tell these links are just the visual cue
of the svg with no other affordance given to users to understand what
they'll do so there is nothing to point `aria-labelledby` at.

An `svg` title was considered, but in reading more about it it seemed
like `aria-label` was more appropriate as it puts the label on the `a`
rather than the `svg` which feels more accurate.

* https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby

Co-authored-by: Matt Wang <matt@matthewwang.me>
JPrevost added a commit to JPrevost/just-the-docs that referenced this issue Sep 7, 2022
Why are these changes being introduced:

* The current tab order requires keyboard or screenreader users to tab
  though all of the navigation links before they get to the main content
  of the page

Relevant ticket(s):

* Discussed as part of larger WCAG ticket just-the-docs#566

How does this address that need:

* Introduces an off screen link as the first element in the tab order
  that will display when it has focus but remain off screen for users
  not using tab to navigate the document.
* Introduces a new scss file with the required style elements and uses
  colors variables to ensure both light and dark mode are respected.

Background information on this technique:

- https://www.w3.org/TR/WCAG20-TECHS/G1.html
- https://accessibility.oit.ncsu.edu/it-accessibility-at-nc-state/developers/accessibility-handbook/mouse-and-keyboard-events/skip-to-main-content/
mattxwang pushed a commit that referenced this issue Sep 10, 2022
Why are these changes being introduced:

* The current tab order requires keyboard or screenreader users to tab
  though all of the navigation links before they get to the main content
  of the page

Relevant ticket(s):

* Discussed as part of larger WCAG ticket #566

How does this address that need:

* Introduces an off screen link as the first element in the tab order
  that will display when it has focus but remain off screen for users
  not using tab to navigate the document.
* Introduces a new scss file with the required style elements and uses
  colors variables to ensure both light and dark mode are respected.

Background information on this technique:

- https://www.w3.org/TR/WCAG20-TECHS/G1.html
- https://accessibility.oit.ncsu.edu/it-accessibility-at-nc-state/developers/accessibility-handbook/mouse-and-keyboard-events/skip-to-main-content/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants