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

User guide has several accessibility issues #3071

Closed
Bukama opened this issue Oct 21, 2022 · 21 comments · Fixed by #3267
Closed

User guide has several accessibility issues #3071

Bukama opened this issue Oct 21, 2022 · 21 comments · Fixed by #3267
Assignees
Milestone

Comments

@Bukama
Copy link
Contributor

Bukama commented Oct 21, 2022

The JUnit user guide has several, repeating accessibility issues, resulting in not fulfilling the "AA" requirements definied by WCAG (and picked up by laws, e.g. the German BITV 2.0).

According to WAVE analysis there are 205 errors and 1174 contrast errors. After a quick view it seems that all of them go down to two things:

  • Empty links: Violates level A requirement "2.4.4 Link Purpose (In Context)" of WCAG
  • Very low contrast: Violates level AA requirement "1.4.3 Contrast (Minimum) (Level AA)"

overallreport

To fix the empty links it's necessary to provide text within the link that describes the functionality and/or target of that link.

To fix the low contrast errors the CSS of the code examples should be adjusted to give a proper contrast. All low contrast errors I randomly checked were located in code examples have a contrast ratio of 4.49:1, but WVAG level AA requires to meet 4.5:1. So only slight adjustments should fix all of these errors. For example changing the current #008080 to #005555 should result in a contrast fulfilling even AAA level.

lowcontrast

Of the 98 alerts the 85 layout tables warnings are problematic, as screen readers (like NVDA or JAWS) read out the table structure. also the fact that no valid HTML 5 with navigation and content regions / elements is definied is problematic for users who are in need of screen readers etc. as those tools could not identify the page structure.

@marcphilipp
Copy link
Member

Apart from syntax highlighting we're using the default Asiidoctor template/styles. Is there a corresponding issue there (e.g. for the "empty link" issue)?

@Bukama
Copy link
Contributor Author

Bukama commented Oct 21, 2022

When I search in their 700+ open issue for accessibility it comes down to 6 open (and 3 closed). One of them ( asciidoctor/asciidoctor#242 ) topics HTML5 but a little bit other to what I've mentioned. There are no issues for the contrast one.

Of course there is none for the links as a style can't know what links you create.

@marcphilipp
Copy link
Member

@Bukama Could you make the full report available please or provide instructions how to recreate it?

@Bukama
Copy link
Contributor Author

Bukama commented Oct 22, 2022

  1. Install Wave Evaluation Tool (e.g. Chrome extension).
  2. Open JUnit User Guide: https://junit.org/junit5/docs/current/user-guide/
  3. Open/Activate WAVE extension. It will analyse the page and create the report.

The report is dynamic so you can click on an issue and the plugin jumps to the certain point of the page, where the issue is placed. I don't know away to export it, but havn't checked in detail to be honest to have the dynamic links.

@marcphilipp
Copy link
Member

Thanks!

The empty links come from using this feature:

"sectanchors" to true,

I guess we could disable it but it's quite useful for linking to specific sections.

@Bukama
Copy link
Contributor Author

Bukama commented Oct 30, 2022

Apart from syntax highlighting we're using the default Asiidoctor template/styles. Is there a corresponding issue there (e.g. for the "empty link" issue)?

For your information: I've just created one for this specific issue of the default template. asciidoctor/asciidoctor#4381

@Bukama
Copy link
Contributor Author

Bukama commented Nov 1, 2022

According to asciidoc team, asciidoc "only" uses 3rd party syntax highlighter and if users want to change the style they can use a different one. They redirected me to https://docs.asciidoctor.org/asciidoctor/latest/syntax-highlighting/rouge/

in which https://github.com/rouge-ruby/rouge/tree/HEAD/lib/rouge/themes is linked for styling themes. From just looking at the theme codes I can't get an impression how it would fit together, so I think it will be try and error to test which theme fits the general user guide layout and has proper contrast values.

@Bukama
Copy link
Contributor Author

Bukama commented Apr 16, 2023

I just wanted to leave a comment here as note / entry point:

  • The default code highlighter is rogue (see comment above)
  • It's possibel to use other code styles for rogue, see this theme repo. All entries are three years old - meaning from a time, where less people payed attention to accessibility than today. It must be checked if there is an accissble theme in there.
  • It's possible to create own code highlighter or extend existing ones. The example from the asciidoc-docs do this for rogue.

@marcphilipp
Copy link
Member

@Bukama Thanks for sharing the results of your research! IIRC we switched to Rogue since it had the best support for highlighting in the generated PDF. Would you have time to try out the built-in options from the theme repo?

@Bukama
Copy link
Contributor Author

Bukama commented Apr 16, 2023

Will try to fine some time for refreshing my fork and trying out to generate the user guide (last look into the JUnit project is ... ah .. long time ago 👼 ) .

@marcphilipp
Copy link
Member

Thanks! ./gradlew asciidoctor should do the trick.

@Bukama
Copy link
Contributor Author

Bukama commented Apr 20, 2023

Tonight I tried all the available themes from the rogue theme repo

This is the output:

+-----------------+-----------------+
|      theme      | contrast errors |
+-----------------+-----------------+
| base16rb        |            1191 |
| bw              |               0 |
| colorful        |            7541 |
| github          |            1191 |
| gruvbox         |             824 |
| igor_pro        |            1191 |
| magritte        |            1178 |
| molokai         |            5068 |
| monokai         |            5068 |
| monokai_sublime |            1191 |
| pastie          |             807 |
| thankful_eyes   |             150 |
| tulip           |             150 |
+-----------------+-----------------+

So the bw (black and white) theme solves all contrast errors, but it comes with some not that nice side effect. As its defines white (FFFFFF) as back ground you can't really distinguish between switch from regular documentation to code and back

junit5_bw

I tried starting to create a custom theme (with a blue blackground at the start to see if my setup is correct), but up to now I fail include the theme file. The docs say that you have to do

asciidoctor -r ./rouge_themes/custom.rb sample.adoc

So I thought I have to include it this resources block

resources {
  from(sourceDir) {
    include("tocbot-*/**")
    include("resources/themes/rogue_junit.rb")
  }
}

But it does not get picked up (yet). As I'm tired and don't have any further idea why I'll leave it for today.

@marcphilipp
Copy link
Member

@Bukama Thanks for trying this out! If you push your temporary branch, I'd be happy to take a look if I can get it to be picked up.

@Bukama
Copy link
Contributor Author

Bukama commented Apr 23, 2023

Thank you @marcphilipp for helping with the setup!

As I wanted to keep visual syntax highlighting in place I decided against the basic bw theme and modified to other themes. The github theme is a theme with light code blocks where I only had to change the color for comments as the grey had a low contrast on the light background. So I had to had to darken it which results in that you can hardly (to be honest I can't) distinguish between comments and regular code (not syntax code), but I think this is totally okay in a user guide like this.

junit_userguide_lightcode

The other theme I extended was the Gruvbox theme which has dark code blocks. Here I had to change the red of the import statements and also the grey of the comments. The differences between regular user guide and all code in the code blocks is stronger than in the light theme above:

junit_userguide_darkcode

Of course some creative people may come to an other solution, but I'm not very creative. I just played a bit with the sliders of the accessibility tools ;)

So now it's you to decide. The PR contains both themes at the moment.

edit: About the other issues I'm not sure if we can fix them. For example the NOTE sections are rendered as tables, but there is not attribute to specify to render it in another way.

@marcphilipp
Copy link
Member

Team decision: Let's go with the light theme.

@marcphilipp marcphilipp added this to the 5.10 M1 milestone May 5, 2023
marcphilipp added a commit that referenced this issue May 6, 2023
The rouge code formatting themes are used by asciidoc, which is used to
create the user guide. But the default theme and all overs, except the
"bw" theme, will create low color contrast, which can be problematic
for people with visual restrictions.

Instead of using rouge's "bw" theme a custom theme was created to tackle
these issue, because using the "bw" theme there was no visual switch
between regular text and code examples.

The created theme is a light themes that solves all contrast errors in
the user guide. However it can't fix other accessibility problems of
the user guide, like missing link textes. Those other problems have to
be fixed seperately.

Resolves #3071.

Co-authored-by: Marc Philipp <mail@marcphilipp.de>
@sbrannen
Copy link
Member

sbrannen commented May 6, 2023

@Bukama, is it possible to use something like dark green for comments instead of gray?

When I view the User Guide snapshots, it looks like comments are the same color as normal code, which I find confusing.

@Bukama
Copy link
Contributor Author

Bukama commented May 7, 2023

@Bukama, is it possible to use something like dark green for comments instead of gray?

When I view the User Guide snapshots, it looks like comments are the same color as normal code, which I find confusing.

As written in my post above I mentioned that.

So I had to had to darken it which results in that you can hardly (to be honest I can't) distinguish between comments and regular code (not syntax code),

I didn't adjusted any colors after Marc didn't ask for changes. But to come back to your question: In general it should be possible. Should be one of the P_GRAY_0 variables in the theme, but I never found any guide about this when I reviewed the themes (and I'm not very creative in such things so most probably just try some of them).

@sbrannen
Copy link
Member

sbrannen commented May 7, 2023

Hi @Bukama,

Thanks for the feedback, and sorry for missing your original comments about the "comment" color.

I'll see if I change it to something reasonable.

sbrannen added a commit that referenced this issue May 7, 2023
- comments are now dark green instead of gray

- method invocations are now dark blue instead of dark green

These changes have been checked with the WAVE Evaluation Tool extension
in Google Chrome.

See ##3071
@sbrannen
Copy link
Member

sbrannen commented May 7, 2023

FYI: I improved the color palette in 3ab4d51.

@sbrannen
Copy link
Member

sbrannen commented May 7, 2023

Seeing the two of you referring to "rogue" instead of "rouge" made me chuckle. 😄

Rouge is a color or "any of various cosmetics for coloring the cheeks or lips red".

Whereas, rogue means "one whose behavior resembles that of a rogue elephant in being aberrant or independent".

I know, I know... very similar spellings and easy to confuse.

@Bukama
Copy link
Contributor Author

Bukama commented May 7, 2023

@sbrannen Yeah I'm not a native speaker (and for me rogue is a class in World of Warcraft 🙈 )
Thank you for adjusting the colors!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants