-
Notifications
You must be signed in to change notification settings - Fork 75
Error field is not identified using color differences only #1914
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
Error field is not identified using color differences only #1914
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work. There are still quite a bunch of precision to add to the Applicability and Expectation to meet the requirements of ACT rules 😃
|
||
## Applicability | ||
|
||
This rule applies to any error field that is [visible][]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is an "error field"? This needs an unambiguous and objective definition.
|
||
```html | ||
<label for="first_name" style="color:#dd0000">First Name</label> | ||
<input type="text" id="first_name" autocomplete="given-name" style="border:3px solid #dd0000" aria-invalid="true"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making it required
would make it more obvious the reason why this is an error, especially with an explicitly optional field in the form. Makin the last name also required
could make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
|
||
### Passed | ||
|
||
#### Passed Example 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel we need examples that use something else than text inputs and other errors than absence of a required field. That can be both other built-in errors (check the list of constraint validation errors for inspiration); or custom errors (e.g. "password must contain at least 8 characters, …" that is usually checked by some script).
Notably, that would show that the rule also considers custom errors.
Also, I do believe that if built-in constraint validations are failing, the UA should automagically set aria-invalid
(needs to be tested).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with different examples and added more details in what's failing.
See also my previous feedback about "required" and browser form validation (something to add in assumptions).
<label for="first_name" style="color:#dd0000">First Name</label> | ||
<input type="text" id="first_name" autocomplete="given-name" style="border:1px solid #dd0000" aria-invalid="true"> | ||
<label for="last_name" style="color:#333333">Last Name</label> | ||
<input type="text" id="last_name" autocomplete="family-name" style="border:1px solid #b0b0b0" value="Doe"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be an example where the color difference is only on the field (the labels don't even have a color difference), and one where it is only on the label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated keeping both label and border colors and added 2 failed examples for only label color and only input border color
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added also inapplicable example with hidden form.
|
||
### Inapplicable | ||
|
||
#### Inapplicable Example 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be an example where there are only non-errored form fields.
|
||
```html | ||
<p>This is a paragraph.</p> | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add the reference list of the terms used in the rule.
For example, you use [visible][]
, so there should be here a definition:
[visible]: #visible 'Definition of Visible'
(see how it's done in other rules files
…is-not-identified-using-color-only-i3z4v8.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to define "visual context" (or find a way to do without it...)
_rules/error-field-is-not-identified-using-color-only-i3z4v8.md
Outdated
Show resolved
Hide resolved
_rules/error-field-is-not-identified-using-color-only-i3z4v8.md
Outdated
Show resolved
Hide resolved
_rules/error-field-is-not-identified-using-color-only-i3z4v8.md
Outdated
Show resolved
Hide resolved
_rules/error-field-is-not-identified-using-color-only-i3z4v8.md
Outdated
Show resolved
Hide resolved
The email `input` value is missing the "@" symbol. Its visual error indicator (the first couple of `label` and `input` elements) conveyed the presence of an error through its CSS properties: | ||
- lightness (difference in relative luminance between the colors leads to a contrast ratio greater than 3:1) AND; | ||
- font-weight: bold. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The email `input` value is missing the "@" symbol. Its visual error indicator (the first couple of `label` and `input` elements) conveyed the presence of an error through its CSS properties: | |
- lightness (difference in relative luminance between the colors leads to a contrast ratio greater than 3:1) AND; | |
- font-weight: bold. | |
The email `input` value is missing the "@" symbol. Its visual error indicator (the first couple of `label` and `input` elements) conveyed the presence of an error through its CSS properties: | |
- lightness (difference in relative luminance between the colors leads to a contrast ratio greater than 3:1); and | |
- `font-weight: bold`. |
I think it would make sense to have the different contrast being the only difference. Otherwise, tools or methodologies that ignore it but accept font-weight
would still be considered consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to maintain best practices to the passed example. Do you think could be acceptable to remove font-weight: bold
from the passed example description, but keep it in the passed example code as per new edits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to exert the rule to its limit (and the tools). Since the rule considers that a single difference is enough, we should have test cases with that, even if they are not best practice. This is part of the One thing at a time guideline in our design guide.
(actually, the case could even has a contrast ratio of exactly 3:1 to ensure that tools do accept that limit)
We can add to the background that while contrast alone is enough, it is a better practice to also use something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
font-weight removed and added a paragraph in background section.
_rules/error-field-is-not-identified-using-color-only-i3z4v8.md
Outdated
Show resolved
Hide resolved
_rules/error-field-is-not-identified-using-color-only-i3z4v8.md
Outdated
Show resolved
Hide resolved
_rules/error-field-is-not-identified-using-color-only-i3z4v8.md
Outdated
Show resolved
Hide resolved
_rules/error-field-is-not-identified-using-color-only-i3z4v8.md
Outdated
Show resolved
Hide resolved
|
||
## Applicability | ||
|
||
This rule applies to any [visible][] [input error][] together with its visual context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that "visual context" is objective enough for Applicability 🤔
(see the discussions we have on the "link context" definition)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the generic "visual context" with a more detailed list of elements that should be included in the evaluation.
I'm not sure about the "closest error message that refers to it" is objective enough.
Co-authored-by: Jean-Yves Moyen <jym@siteimprove.com>
Co-authored-by: Jean-Yves Moyen <jym@siteimprove.com>
|
||
This rule applies to any [visible][] [input error][] together with: | ||
- its [programmatic label]; and | ||
- the closest error message that refers to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, "closest" is ambiguous. It could notably be distance in the DOM tree, or physical distance on screen between the painted elements.
|
||
This rule applies to any [visible][] [input error][] together with: | ||
- its [programmatic label]; and | ||
- the closest error message that refers to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not sure that "error message" is unambiguous.
For example, putting a red cross next to errored field and a green check mark next to good ones, is a red cross an "error message" (it's not really a message)? (or the red border of Passed Example 3)
|
||
## Expectation | ||
|
||
Each test target, together with its visual context, identify the presence of errors not only through color differences. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to change "visual context" here also.
|
||
## Applicability | ||
|
||
This rule applies to any [visible][] [input error][] together with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not fully convinced that "input error" is unambiguous enough.
information provided by the user that is not accepted
Does that mean that the field in which it was inputed is put in a validation error state? Or just that some code checked it and rejected it, without changing the validation state? Actually, this refers to the information, not even to the form field, is it what you want the rule to target?
- [Understanding Success Criterion 1.4.1: Use of Color](https://www.w3.org/WAI/WCAG21/Understanding/use-of-color.html) | ||
- [F81 - Failure of Success Criterion 1.4.1 due to identifying required or error fields using color differences only](https://www.w3.org/WAI/WCAG21/Techniques/failures/F81.html) | ||
|
||
It is possible for an error field to be distinguishable from adjacent fields but still not have a meaningful error message. In that case, it would pass Success Criterion 1.4.1: Use of Color but still fail [Success Criterion 3.3.1: Error Identification](https://www.w3.org/WAI/WCAG21/Understanding/error-identification.html) and, if applicable, [Scuccess Criterion 3.3.3: Error Suggestion](https://www.w3.org/WAI/WCAG21/Understanding/error-suggestion.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible for an error field to be distinguishable from adjacent fields but still not have a meaningful error message. In that case, it would pass Success Criterion 1.4.1: Use of Color but still fail [Success Criterion 3.3.1: Error Identification](https://www.w3.org/WAI/WCAG21/Understanding/error-identification.html) and, if applicable, [Scuccess Criterion 3.3.3: Error Suggestion](https://www.w3.org/WAI/WCAG21/Understanding/error-suggestion.html). | |
It is possible for an error field to be distinguishable from adjacent fields but still not have a meaningful error message. In that case, it would pass Success Criterion 1.4.1: Use of Color but still fail [Success Criterion 3.3.1: Error Identification](https://www.w3.org/WAI/WCAG21/Understanding/error-identification.html) and, if applicable, [Success Criterion 3.3.3: Error Suggestion](https://www.w3.org/WAI/WCAG21/Understanding/error-suggestion.html). |
|
||
#### Passed Example 2 | ||
|
||
The "phone number" `input` value doesn't match the `type` value. Its visual error indicator (the first couple of `label` and `input` elements) conveys the presence of an error through its CSS properties: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description uses "visual error indicator", which doesn't match the "error message" used in the Applicability. What does "visual error indicator" refers to?
(same on other descriptions)
|
||
#### Failed Example 1 | ||
|
||
The "first name" `input` value is empty. Its visual error indicator (the red border color of the first `input` element) conveys the presence of an error through color (hue) differences only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add the contrast ratio with the other border color, to drive the nail in.
|
||
#### Inapplicable Example 1 | ||
|
||
There are no error fields. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These descriptions should talk about "input error", not "error field", in order to match the Applicability.
I've completely revised the rule by setting objective applicability and unambiguous expectation that should address all the remaining items you've listed above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to find a way to tell in the Expectation what we are comparing the errored field with.
|
||
## Applicability | ||
|
||
This rule applies to each [HTML element][] that is [visible][] and has one of the following [semantic roles][]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule applies to each [HTML element][] that is [visible][] and has one of the following [semantic roles][]: | |
This rule applies to any [HTML element][] that is [visible][] and has one of the following [semantic roles][]: |
Each test target either has no [visible][] [form field error indicators][], or at least one of the [visible][] [form field error indicators][] identifies the presence of errors not only through color differences. | ||
|
||
## Assumptions | ||
|
||
When content is communicated using colors that vary not just in hue but also have a substantial difference in brightness, this constitutes an extra visual differentiation provided that the difference in the colors' relative luminance creates a contrast ratio of 3:1 or more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we somehow need to put in the Expectation the fact that "contrast of 3:1 or more" is not a color difference.
We probably need to keep an assumption that this is indeed enough, but we also want to say in the "normative" part that the rule accepts this.
|
||
## Expectation | ||
|
||
Each test target either has no [visible][] [form field error indicators][], or at least one of the [visible][] [form field error indicators][] identifies the presence of errors not only through color differences. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing a potential pitfall here (also when looking at examples):
This somewhat implicitly consider that we have something to compare the error indicator to, in order to decide whether it is color differences or more (i.e. "differences" with what?)
This could either be another field, not in error, in the same form, or the same field when not errored.
The second solution somewhat requires a statefull rule and the tester to act (and put the field in error). This hopefully will be doable soonish (once we've solved #1953 / #2045), but that may still take time.
The first point could be doable by targeting pairs of field, passing if they are both errored or none errored, and comparing if only one is errored 🤔
Put otherwise: if there is only one form field in the page, and it is in error, how do we check the rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could either be another field, not in error, in the same form
Comparing a pair of inputs, where one fails and the other does not, is not an optimal approach. Additionally, inputs may have different styles, such as checkboxes or text fields. Therefore, it is advisable to only compare inputs of the same type and with the same CSS.
Put otherwise: if there is only one form field in the page, and it is in error, how do we check the rule?
Limiting the rule to a specific pair of inputs (assuming the previous concern is addressed) would, in my opinion, be too restrictive.
I think we should go with the second option. @Jym77, should we put this rule on hold till #1953 / #2045 are solved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a list worth bringing to attention that this is another rule proposal that would benefit from being statefull, so that we are sure the solution can handle it.
Very out of date. Closing on behalf of @giacomo-petri |
Proposal for a new rule to check errors are not identified using color differences only.
Closes issue(s):
Need for Call for Review:
This will require a 2 weeks Call for Review
Pull Request Etiquette
When creating PR:
develop
branch (left side).After creating PR:
Rule
,Definition
orChore
.When merging a PR:
How to Review And Approve