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

AGWG feedback: Text has minimum/enhanced contrast #226

Closed
WilcoFiers opened this issue Jun 27, 2023 · 10 comments
Closed

AGWG feedback: Text has minimum/enhanced contrast #226

WilcoFiers opened this issue Jun 27, 2023 · 10 comments

Comments

@WilcoFiers
Copy link
Collaborator

Source:

On using highest possible contrast

From Gregg Vanderheiden
it reads This rule applies to any visible character in a text node that is a child in the flat tree of an HTML element, except if the text node has an ancestor in the flat tree for which at least one of the following is true:
<skip exceptions>
For each test target, the highest possible contrast between the foreground colors and background colors is at least 4.5:1 or 3.0:1 for larger scale text, except if the test target is part of a text node that is purely decorative or does not express anything in human language.

PROBLEM(S)
this talks about "text". a paragraph is text. according to this test - if I have a paragraph of white text over a background of broad black and white stripes - the text passes as long as one piece of one character of the text I over the black background.

Changes suggested

  1. change 'any character' to 'every character' or 'each character'
  2. change to "if anti-aliasing or dithering is used - choose the darkest part of a character's stem and evaluate it against the darkest part of the background adjacent to it.
  3. if the character or the background is not homogeneous - then choose the darkest pixel at different points along the stem and compare to the darkest part of the background adjacent to it.

From Makoto Ueki:
+1 to 3 changes suggested by Gregg.

From Michael Gower
The wording "highest possible contrast of every text character" put up warning bells for me, because we've tended to require every pixel of all text characters to pass (ignoring antialiasing). But I don't see any situation where you have some pixels passing and others failing; even in the ones with gradient backgrounds, all characters seem to pass (or fail). We may need to explore some more examples.

From Detlev Fischer:
I have understood the wording "highest possible contrast of every text character" as meaning that if there are conforming alternate versions (say, style switchers improving contrast), the best available contrast should be checked. But now reading other replies, that may have been the wrong understanding. If it really means that for text on image or pattern backgrounds, you are to pick the most contrasting adjacent pixel even if most others are low contrast and the text is illegible in practice, this needs to be revised. Clarify?

Wording of contrast levels

From Gundula Niemann:
The grammar in the expectation leaves it unclear, when to fulfill which contrast threshold. This should be changed.

Suggestion:
For each test target, the highest possible contrast between the foreground colors and background colors is at least 4.5:1 for smaller scale text or 3.0:1 for larger scale text, respectively, except if the test target is part of a text node that is purely decorative or does not express anything in human language.

From Andrew Kirkpatrick:
But I do wonder if it might make sense to have a small text and large text version of the same test?

Other

From Michael Gower
It's only tackling text, not images of text here, correct? Is it worth stating that explicitly?

Failure 8 is borderline to me. I agree the text should meet contrast and that it is not "entirely decorative", but using the phrase "not only for aesthetic purposes" is unfortunate here -- and indicates why this is barely in scope. There is NO other reason to show the 'quick brown fox' phrase except aesthetics. The text is there just to show what the characters look like; the nature of the font family is the information it provides (and the reason to me it fails to meet 'entirely decorative'). But the words are only there because they contain all the letters of the English alphabet. It could as easily just be the letters A-Z, so it almost meets the substitute characters test.

I need to better understand the SVG in Inapplicable #4. What does it matter if it isn't in HTML? It's still text, and still on a web page.

From Gundula Niemann:
I do not agree to the exception:
When is a text purely decorative?
Text in non-human language can be subject of information as well, like examples for fonts, riddle text, encrypted text, so I recommend to drop the second exception.
Is a mathematical formula part of human language?

From Makoto Ueki:
For the Passed Example 5 and 6, each text size can be different for some different languages. For Japanese characters, the large text size for the Example 5 should be at least 22pt and the bold text size for the Example 6 should be 18pt, as calculated in the JIS (Japanese national standard). It might be good enough to add a note to avoid misunderstanding, saying that these text sizes can be different for different languages.

From Detlev Fischer:
Should an assumptinon be added that the test is valid only for a specific viewport width, to account for the not infrequent situation of text being sufficiently contrasty at some viewport width but not at another?

@WilcoFiers
Copy link
Collaborator Author

WilcoFiers commented Jun 27, 2023

ACT Task Force Response (approved)

On using highest possible contrast

ACT Rules test for failure conditions. The way this works is that failing these rules means their corresponding success criterion is not satisfied. However passing the rule still requires further testing. This is described in the Accessibility Requirements section on the rule page.

ACT takes its interpretations from WCAG documentation. Without an unambiguous description of how to find appropriate foreground and background colors, the question of what color values to use is left open to interpretation. Some testers are stricter than others on how these contrast is measured. When these rules were originally written lowest contrast was considered, but rejected because there were too many open questions about how to test contrast consistently without false positives.

Examples of such questions include:

  1. How far from each pixel in the text do you measure the contrast?
  2. Should you measure against touching, or slightly overlapping content?
  3. Should text effects such as underline and stroke be ignored? If not are they foreground or background?
  4. What should be considered the foreground and background on text with a text stroke?
  5. How do you handle text that is all aliasing, or text that is blurred?

These are questions we did not feel equipped to answer. To avoid failing success criteria that shouldn't be we decided to use highest possible contrast.

Wording of contrast levels

We have updated the rule to use the following wording:

For each test target, the highest possible contrast between the foreground colors and background colors is at least 3.0:1 for large scale text and 4.5:1 for other texts

Other

To Mike Gower

  1. Images of text are indeed out of scope. When we have related ACT Rules, those are linked from the background section of the rule. Beyond that, we've opted not to include information on things that are out of scope of any particular rule. We've tried this in the past and it was an unending conversation of adding more and more things.

  2. We do try to include edge cases where there is agreement about their outcome. Failed example 8 is certainly one such case.

  3. We try to keep ACT Rules atomic. There are many other considerations for testing SVG contrast. That is best left for a different rule

To Gundula Niemann

The "Human language" exception comes directly from WCAG's definition of text, which says:

text
sequence of characters that can be programmatically determined, where the sequence is expressing something in human language

We do believe mathematical formulas meet the definition of human language:

human language
language that is spoken, written or signed (through visual or tactile means) to communicate with humans

To Makoto

Thank you for the suggestion. We have opened an issue to make the rule stricter when measuring contrast on CJK characters. As not having this doesn't seem to produce false positives, we believe this shouldn't prevent the rule from getting published.

To Detlev

ACT Rules hold true for whatever state a page is in as it is being tested. Ensuring a page is tested in different states and viewport sizes is the responsibility of a tester. As the Contrast criteria do not include explicit requirements on which viewport sizes to test in, this should not be included in by the rule either.

@tbostic32
Copy link
Collaborator

tbostic32 commented Jun 29, 2023

In the example questions:

If not are the foreground or background?

Fix "the" to "they"

@kengdoj
Copy link
Contributor

kengdoj commented Jun 29, 2023

Regarding Gregg's third concern about text with a mixed background where part of the character passes and part of the character fails, the rule includes Failed Example 3.

Also, in last sentence in response To Detlev: remove the words "is" and "by"

this is should not be included in by the rule either.

@mraccess77
Copy link

We have some guidance on testing each pixel next to letters in this sufficient technique ttps://www.w3.org/WAI/WCAG21/Techniques/general/G18
This technique also has guidance for aliasing: "For aliased letters, use the relative luminance value found two pixels in from the edge of the letter."

In addition, I would prefer to say "lowest contrast" text rather than highest. Highest would mean that it only takes one contrast pixel for the whole letter to pass.

Another option is to go with the approach from 1.4.11 and that is to say if you were to remove the non-contrasting portions could you still tell what the letter is? If so, it could pass. If not - it fails.

@WilcoFiers
Copy link
Collaborator Author

@mraccess77 Two pixels from the edge of the letter doesn't seem to work. That includes things that should obviously not be considered background, like other letters, underlines, icons, etc. But there are also lots of grey areas here, like 3D letter effects, small shadows on one side of the text, strike-through, non-overlapping adjacent images, etc.

I certainly think looking at the shape of letters after the low-contrast portions are removed is worth exploring. I don't think ACT Task Force is the right group to work on that. That doesn't fit our work statement and we don't have the right people do to that kind of work, but if LVTF or some other group in AGWG were to come up with recommendations in that area, we would definitely look at that and try to incorporate it in the rules. I think that would still be difficult to do consistently. What letters I recognize with parts hidden might be very different from what you do, or from what different machine vision algorithms do. Still, we'd certainly see if it could be used to make the rule stricter.

The more important question for AGWG I think is do we want to just have no rules covering color contrast until someone finds a good solution for this, or can we make due with a rule that cover 95% of all cases (one text color, on one background color, with some aliasing between) and accept that some edge cases are left as "further testing needed"?

@mraccess77
Copy link

mraccess77 commented Jul 18, 2023

The thing I'd like to avoid is setting a precedent of "Highest Possible Contrast as this seems to contradict with the technique G18. The decisions on what conforms to WCAG falls to AG but some could construe that this rule makes that practice de facto. I would be ok if we could add some text clarifying that a pass of this rule may not mean a conformance of the SC - which I think we sort of allude to with the statement on passes requiring additional testing of the SC.

From a practical testing standpoint I understand we do need to come up with a test that is reasonable.

@WilcoFiers
Copy link
Collaborator Author

I would be ok if we could add some text clarifying that a pass of this rule may not mean a conformance of the SC

This is mentioned in these rules in two places. First in the background, and then in the accessibility requirements section:

Background

Passing this rule does not mean that the text has sufficient color contrast. If all background pixels have a low contrast with all foreground pixels, the success criterion is guaranteed to not be satisfied. When some pixels have sufficient contrast, and others do not, legibility should be considered. There is no clear method for determining legibility, which is why this is out of scope for this rule.

...

Accessibility Requirements Mapping

1.4.3 Contrast (Minimum) (Level AA)
Required for conformance to WCAG 2.0 and later on level AA and higher.
Outcome mapping:

  • Any failed outcomes: success criterion is not satisfied
  • All passed outcomes: success criterion needs further testing
  • An inapplicable outcome: success criterion needs further testing

These two sections are where this information would normally go. Can you suggest improvements that we could make here that would address your concern?

@mraccess77
Copy link

mraccess77 commented Jul 19, 2023

Perhaps we could tweak this part "There is no clear method for determining legibility, which is why this is out of scope for this rule."
to
"There is no clear method for determining legibility when some but not all pixels have sufficient contrast, which is why passing this rule does not necessarily mean the corresponding success criterion is met."

@WilcoFiers
Copy link
Collaborator Author

I opened a PR ☝️

@WilcoFiers
Copy link
Collaborator Author

WilcoFiers commented Sep 4, 2023

Response has been accepted with the amended rule.

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

4 participants