Skip to content

New rule: Text nodes have minimal contrast #833

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

Merged
merged 58 commits into from
Jan 30, 2020

Conversation

WilcoFiers
Copy link
Member


Pull Request Etiquette

When creating PR:

  • Make sure you requesting to pull a branch (right side) to the develop branch (left side).

After creating PR:

  • Add yourself (and co-authors) as "Assignees" for PR.
  • Add label to indicate if it's a Rule, Definition or Chore.
  • Close the issue that the PR resolves (and make sure the issue is referenced in the top of this comment)
  • Optionally request feedback from anyone in particular by assigning them as "Reviewers".

How to Review And Approve

  • Go to the “Files changed” tab
  • Here you will have the option to leave comments on different lines.
  • Once the review is completed, find the “Review changes” button in the top right, select “Approve” (if you are really confident in the rule) or "Request changes" and click “Submit review”.

@kasperisager
Copy link
Contributor

kasperisager commented Aug 26, 2019

@kasperisager
Copy link
Contributor

@WilcoFiers Let me know what you think: 83161d2

@jeeyyy jeeyyy changed the title new rule: Text nodes have minimal contrast New rule: Text nodes have minimal contrast Sep 2, 2019
key: disabled
---

An element that is normally [perceivable][] and [operable][], but has been rendered [inoperable][operable] either temporarily or permanently, is considered disabled. While there exists several techniques through which elements can be disabled, the most typical are:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kasperisager This definition is ambiguous, as it leaves room for other unspecified ways of disabling elements. That's not allowed in the applicability of a rule. I suggest we keep it simpler and stick to the two items you have here, leave out the part about perceivable / (in)operable. If you want to leave room for a future "disabled" definition that does include those, we can call this definition "programatically disabled" or something along those lines. Not my preference, I'd rather not try to anticipate the future, but I wouldn't be opposed to it either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be fine with sticking to disabled and aria-disabled 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WilcoFiers Let me know if 174c64e does the trick. I've left in "perceivable" and "operable" but otherwise restricted the ways in which elements can be "disabled".

@WilcoFiers WilcoFiers marked this pull request as ready for review September 9, 2019 11:02
Jym77
Jym77 previously requested changes Sep 11, 2019
Copy link
Collaborator

@Jym77 Jym77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick review. many editorials and some questions.

---

All colors of the pixels not part of the [foreground colors](#foreground-colors-of-text) pixels, in an bounding box around each [visible](#visible) character in a [text node](https://dom.spec.whatwg.org/#text), where the width is the [advance width](https://www.w3.org/TR/css-values/#length-advance-measure
), plus one pixel on the left and right, and the height is the [advance height](https://www.w3.org/TR/css-values/#length-advance-measure).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be an extra newline at the start of this line.

Jym77
Jym77 previously requested changes Dec 16, 2019
Copy link
Collaborator

@Jym77 Jym77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One outstanding issue on the "decorative"/"font example" test case. We might be faster discussing this over a call.

Several nitpicking or polishing editorials…


#### Passed Example 4

This dark grey text has a contrast ratio between 6.1:1 and 9:1 on white background with grey text shadow on it.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if I get it correctly, the bounding box of, says, the 'o' does include the inside of the character which is far away from the shadow and thus has color #737373 and a contrast ratio of 4.42 with the black text.
Which is OK because the rule only considers the highest contrast ratio.

Co-Authored-By: Jean-Yves Moyen <jym@siteimprove.com>
@WilcoFiers WilcoFiers requested a review from Jym77 December 17, 2019 14:40
@WilcoFiers WilcoFiers dismissed Jym77’s stale review December 17, 2019 14:42

Thanks for the suggestions.

Jym77
Jym77 previously requested changes Dec 18, 2019
Copy link
Collaborator

@Jym77 Jym77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shadowRoot.textContent = 'Some text in English'
</script>
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the text is decorative.
I do not understand why a decorative text is relevant for 1.4.11 (as pointed out by the note in Passed Example 7).
(it is not a UI component, and it is not a "Graphical Object" either; so 1.4.11 does not apply)

This is not important enough to block that PR…

Copy link
Collaborator

@danistr danistr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice job :-)

@WilcoFiers WilcoFiers requested a review from Jym77 January 9, 2020 13:01
@WilcoFiers WilcoFiers dismissed Jym77’s stale review January 9, 2020 13:01

Please give it another look


- [Success criterion 1.4.3: Contrast (Minimum)](https://www.w3.org/TR/WCAG21/#contrast-minimum) also has an exception for logos and brand names. Since logos and brand names are usually displayed through images to ensure correct rendering, this rule does not take logos or brand names into consideration. If a logo or brand name is included using [text nodes](https://dom.spec.whatwg.org/#text), this rule may produce incorrect results.

- Text that has the same foreground and background color (a contrast ratio of 1:1) is assumed to be [purely decorative](). The text is assumed to not convey information that is meant for users. Hiding text in this way is sometimes used for search engine optimisation. Text with a contrast of 1:1 does not fail this rule, but may not satisfy [Success criterion 1.4.3: Contrast (Minimum)](https://www.w3.org/TR/WCAG21/#contrast-minimum) if it is not decorative.
Copy link
Collaborator

@EmmaJP EmmaJP Jan 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is good wording to add. It isn't something to encourage and frowned upon by modern search engine algorithms.

@WilcoFiers WilcoFiers requested a review from EmmaJP January 10, 2020 12:54
```

#### Passed Example 8

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Passed Example 8 intended to be an example of something non-meaningful or decorative? If so, should it not be an Inapplicable Example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is an exception mentioned in the expectation. This is because "decorative" is subjective, and the ACT rules format requires the applicability to be objective.

Copy link
Collaborator

@EmmaJP EmmaJP Jan 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So passed example 7 is including text that can be considered decorative (visual only), and passed example 8 is including text that is not conveying meaning.

And in this instance the exceptions are passing examples rather than inapplicable examples because ... ? The only reason I can determine is because the exception is in the expectation rather than the applicability. Is this consistent across rules? Should it be added to the rule guidance docs?

Cause in my understanding, a rule is inapplicable to something that is an exception.

Copy link
Collaborator

@Jym77 Jym77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me now 😄

WilcoFiers and others added 3 commits January 14, 2020 14:35
Co-Authored-By: EmmaJP <emma.richens@bbc.co.uk>
Co-Authored-By: EmmaJP <emma.richens@bbc.co.uk>
@WilcoFiers WilcoFiers added Review call 2 weeks Call for review for new rules and big changes and removed reviewers wanted labels Jan 14, 2020
@WilcoFiers WilcoFiers merged commit 89ad7e2 into develop Jan 30, 2020
@WilcoFiers WilcoFiers deleted the color-contrast-text-nodes branch January 30, 2020 09:40
@Jym77
Copy link
Collaborator

Jym77 commented Jan 30, 2020

Congratulations on completing that one!
That was a lot of difficult precision work chiseling it to perfection 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review call 2 weeks Call for review for new rules and big changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.