-
Notifications
You must be signed in to change notification settings - Fork 54
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
Improve a11y of form error state v2 #2090
Conversation
✅ Deploy Preview for boosted ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Will be a fresh start for #1949 |
scss/_reboot.scss
Outdated
@@ -96,13 +96,13 @@ body { | |||
@include focus-visible(); // 1 | |||
} | |||
|
|||
.js-focus-visible :focus:not([data-focus-visible-added]):not(.focus-ring), | |||
.js-focus-visible .focus:not([data-focus-visible-added]):not(.focus-ring) { // 2 | |||
.js-focus-visible :focus:not([data-focus-visible-added]):not(.focus-ring):not(.form-select:invalid), |
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.
Needed by Chrome and Firefox.
scss/_reboot.scss
Outdated
outline: 0 !important; | ||
box-shadow: none; | ||
} | ||
|
||
:focus:not(:focus-visible):not(.focus-ring) { // 3 | ||
:focus:not(:focus-visible):not(.focus-ring):not(.form-select:invalid) { // 3 |
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.
Needed by Firefox.
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.
LGTM! To me this solution seems more logical in terms of UX, so let's wait for the design review if they are fine with 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.
👌
All looks good to me. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Form control file in https://deploy-preview-2090--boosted.netlify.app/docs/5.3/forms/validation/#supported-elements hasn't the outlines when focused with a mouse click. Tried few things really quickly if it can help:
.form-control[type="file"] {
@include form-validation-state-selector($state) {
border-color: $border-color;
&:focus {
@include focus-visible();
border-color: $border-color !important; // stylelint-disable-line declaration-no-important
}
// End mod
}
}
:not(.form-control[type="file"]:invalid) Note: there's probably something overriding the |
Yes it's really strange. |
@julien-deramond: as discussed in today's daily meeting, the existing rule for |
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.
Nice! LGTM! 🚀
Related issues
Closes #1918
Description
The goal of this PR is to improve focus to allow sufficient contrast between error field focused and non focused.
Before this PR
Once a form is on error: fields on error will gain a red border and black one when focused
The main problem here is in a11y we can't convey an information by color alone because it can be not noticeable for certain types of colorblindness.
This references WCAG criterion 1.4.1 Use of Color (Level A).
For someone suffering from achromatopsia for instance, the same example will look like:
All fields on error look almost identical, causing an a11y issue.
After this PR
The recent work on focus (see #1437) was applied to fields on error to add a visual cue so information does not rely exclusively on color anymore:
And for someone suffering from achromatopsia:
Motivation & Context
A11y improvement for people suffering for any form of colorblindness.
Types of change
Live previews
Checklist
Contribution
Accessibility
Design
Development
Documentation
Checklist (for Core Team only)
After the merge