-
Notifications
You must be signed in to change notification settings - Fork 844
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
[EuiForm] Increase Contrast on EuiForm
Section Controls to Pass WCAG AA Standards
#6729
Conversation
…election controls to meet WCAG AA guidelines for graphical objects and user interface components. Updated the hard coded form styles test case that targets customControlBorderColor with the updated HEX value
…lection controls to meet WCAG AA guidelines for graphical objects and user interface components.
Preview documentation changes for this PR: https://eui.elastic.co/pr_6729/ |
…tch background color and allows it to meet WCAG AA UI guidelines
Preview documentation changes for this PR: https://eui.elastic.co/pr_6729/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_6729/ |
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 changes bring us in line with the 3:1 required contrast ratio. I took a few minutes to experiment with the disabled switch to see if I could make it recede a bit more like the disabled radio and checkbox.
Feel free to use or discard these suggestions. I'll wait for @andreadelrio for the final word on color.
Thanks @breehall !
I like this proposal for light mode. For dark mode, I prefer what Bree has above, visually it stands out more. |
…witch in lightmode to help distinguish the state
@andreadelrio @1Copenut Here's the updated Screen.Recording.2023-04-24.at.3.51.16.PM.mov |
|
||
&:disabled { | ||
&:hover, | ||
~ .euiSwitch__label:hover { | ||
cursor: not-allowed; | ||
} | ||
|
||
.euiSwitch__body { | ||
background-color: $euiSwitchOffDisabledColor; | ||
} | ||
|
||
.euiSwitch__thumb { | ||
background-color: $euiSwitchOffThumbDisabledColor; | ||
border-color: $euiSwitchOffThumbDisabledBorderColor; | ||
box-shadow: none; | ||
} | ||
|
||
.euiSwitch__icon { | ||
fill: $euiColorDarkShade; | ||
} | ||
|
||
+ .euiSwitch__label { | ||
color: $euiFormControlDisabledColor; | ||
} | ||
} |
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 reason I moved this under the aria
styles is to ensure the background color for disable overrides the selected (blue) background color if the switch is active but also disabled.
$euiSwitchOffDisabledColor: lightOrDarkTheme(transparentize($euiColorLightShade, .5), transparentize($euiColorDarkShade, .4)) !default; | ||
$euiSwitchOffThumbDisabledColor: rgba(0,0,0,0) !default; | ||
$euiSwitchOffThumbDisabledBorderColor: lightOrDarkTheme(transparentize($euiColorDarkShade, .5), $euiColorDarkShade) !default; | ||
|
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 euiFormCustomControlBorderColor
affects other components and I felt it would be best to add the switch specific styles as their own keys.
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 that's a good call. They're unique to the switch component, so having them called out and labeled is helpful.
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.
Quick 2c: If they're only being used by the switch, can we define them in Sass where they're used instead of as a global form variable? (i.e., in _switch.scss
below line 47).
This will (hopefully) prevent downstream consumers from using them when we only want them as one-off variables.
Didn't mean to add my `prettierrc`
This reverts commit a528e8b.
Preview documentation changes for this PR: https://eui.elastic.co/pr_6729/ |
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!
Apologies for my confusion in Slack regarding the disabled styles! My only remaining change requests are changing the color of the check/cross icons to match the thumb in both light & dark mode for readability, + moving the EuiSwitch Sass variable declarations & a quick comment update. Seriously awesome work on this Bree! And thanks so much Andrea for the design feedback, & Trevor for the really great disabled color change suggestion! |
@andreadelrio You read our minds, we just chatted about that over Zoom! 100% agreed the white X is much easier to read on light mode. |
…ng them directly to the component. - Updated icon color so that icons appear white for both states in light mode and black in dark mode - Misc comment updates
✨ Current Revisions This last push includes a change to the icon colors in both light and dark modes. When in light mode and not disabled, the icons on Feel free to review (once the PR preview loads) and let me know what you think!
No worries! Thank you all for really helping me come to a decision with this! :) |
Preview documentation changes for this PR: https://eui.elastic.co/pr_6729/ |
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 🚀. Great job @breehall !
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.
Fantastic work again Bree. Super small changelog request for you, then I think this is good to go. Also, if we could update the PR description with the final EuiSwitch designs that would be helpful for putting the next EUI newsletter together - thanks!
Co-authored-by: Cee Chen <[email protected]>
Preview documentation changes for this PR: https://eui.elastic.co/pr_6729/ |
…all/eui into form-control-accessibility Pulling commits made in Github UI
$euiSwitchOffDisabledColor: lightOrDarkTheme(transparentize($euiColorLightShade, .5), transparentize($euiColorDarkShade, .4)); | ||
$euiSwitchDisabledThumbColor: lightOrDarkTheme(transparentize($euiColorDarkShade, .5), $euiColorDarkShade); | ||
|
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.
@cee-chen instead of adding these in the disabled
block, I had to add them at a higher level because they're being used in a different scope that targets compressed switches as well
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 good! As long as they're scoped to a selector, they're not available globally 👍
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.
Awesome work on this Bree! 🚢
Preview documentation changes for this PR: https://eui.elastic.co/pr_6729/ |
## Summary `[email protected]` ⏩ `[email protected]` 🦴 The primary changes in this upgrade are around the deprecated `EuiLoadingContent` being removed in favor of `EuiSkeletonText`. - Most instances have been a [direct swap of usage](327626a), but [some replacements were a bit more opinionated](e6ceb36) as I saw them as potential to take advantage of `EuiSkeletonText`'s syntactical sugar and screen reader announcements for when state switches to loaded. --- ## [`79.0.1`](https://github.com/elastic/eui/tree/v79.0.1) **Bug fixes** - Fixed broken push `EuiFlyout` behavior ([#6764](elastic/eui#6764)) ## [`79.0.0`](https://github.com/elastic/eui/tree/v79.0.0) - Updated all `EuiSkeleton` components with new props that allow for more control over screen reader live announcements: `announceLoadingStatus`, `announceLoadedStatus`, and `ariaLiveProps` ([#6752](elastic/eui#6752)) - Improved keyboard accessibility in `EuiPageHeader` by ensuring the right side menu items come into focus from left to right. ([#6753](elastic/eui#6753)) **Breaking changes** - Removed deprecated `EuiLoadingContent`. Use the `EuiSkeleton` components instead. ([#6754](elastic/eui#6754)) ## [`78.0.0`](https://github.com/elastic/eui/tree/v78.0.0) - Improved the contrast ratio of `EuiCheckbox`, `EuiRadio`, and `EuiSwitch` in their unchecked states to meet WCAG AA guidelines. ([#6729](elastic/eui#6729)) - Added React Testing Library `*ByTestSubject` custom commands to `within()`. RTL utilities can be imported from `@elastic/eui/lib/test/rtl`. ([#6737](elastic/eui#6737)) - Updated `EuiAvatar` to support a new letter `casing` prop that allow customizing text capitalization ([#6739](elastic/eui#6739)) - Updated `EuiFocusTrap` to support the `gapMode` prop configuration (now defaults to `padding`) ([#6744](elastic/eui#6744)) **Bug fixes** - Fixed inconsistency in `EuiSearchBar`'s AND/OR semantics between DSL and query string generation ([#6717](elastic/eui#6717)) - Fixed `EuiFieldNumber`'s native browser validity detection causing extra unnecessary rerenders ([#6741](elastic/eui#6741)) - Fixed the `scrollLock` property on `EuiFocusTrap` (and other components using `EuiFocusTrap`, such as `EuiFlyout` and `EuiModal`) to no longer block scrolling on nested portalled content, such as combobox dropdowns ([#6744](elastic/eui#6744)) **Breaking changes** - `EuiAvatar`s with the default `user` type will now default to capitalizing all initials in uppercase ([#6739](elastic/eui#6739)) --------- Co-authored-by: Kibana Machine <[email protected]>
## Summary `[email protected]` ⏩ `[email protected]` 🦴 The primary changes in this upgrade are around the deprecated `EuiLoadingContent` being removed in favor of `EuiSkeletonText`. - Most instances have been a [direct swap of usage](327626a), but [some replacements were a bit more opinionated](e6ceb36) as I saw them as potential to take advantage of `EuiSkeletonText`'s syntactical sugar and screen reader announcements for when state switches to loaded. --- ## [`79.0.1`](https://github.com/elastic/eui/tree/v79.0.1) **Bug fixes** - Fixed broken push `EuiFlyout` behavior ([#6764](elastic/eui#6764)) ## [`79.0.0`](https://github.com/elastic/eui/tree/v79.0.0) - Updated all `EuiSkeleton` components with new props that allow for more control over screen reader live announcements: `announceLoadingStatus`, `announceLoadedStatus`, and `ariaLiveProps` ([#6752](elastic/eui#6752)) - Improved keyboard accessibility in `EuiPageHeader` by ensuring the right side menu items come into focus from left to right. ([#6753](elastic/eui#6753)) **Breaking changes** - Removed deprecated `EuiLoadingContent`. Use the `EuiSkeleton` components instead. ([#6754](elastic/eui#6754)) ## [`78.0.0`](https://github.com/elastic/eui/tree/v78.0.0) - Improved the contrast ratio of `EuiCheckbox`, `EuiRadio`, and `EuiSwitch` in their unchecked states to meet WCAG AA guidelines. ([#6729](elastic/eui#6729)) - Added React Testing Library `*ByTestSubject` custom commands to `within()`. RTL utilities can be imported from `@elastic/eui/lib/test/rtl`. ([#6737](elastic/eui#6737)) - Updated `EuiAvatar` to support a new letter `casing` prop that allow customizing text capitalization ([#6739](elastic/eui#6739)) - Updated `EuiFocusTrap` to support the `gapMode` prop configuration (now defaults to `padding`) ([#6744](elastic/eui#6744)) **Bug fixes** - Fixed inconsistency in `EuiSearchBar`'s AND/OR semantics between DSL and query string generation ([#6717](elastic/eui#6717)) - Fixed `EuiFieldNumber`'s native browser validity detection causing extra unnecessary rerenders ([#6741](elastic/eui#6741)) - Fixed the `scrollLock` property on `EuiFocusTrap` (and other components using `EuiFocusTrap`, such as `EuiFlyout` and `EuiModal`) to no longer block scrolling on nested portalled content, such as combobox dropdowns ([#6744](elastic/eui#6744)) **Breaking changes** - `EuiAvatar`s with the default `user` type will now default to capitalizing all initials in uppercase ([#6739](elastic/eui#6739)) --------- Co-authored-by: Kibana Machine <[email protected]>
Fixes #6690
Fixes #6692
Summary
Increase contrast ratio for checkbox border in
EuiCheckbox
(#6690)The current contrast ratio for checkbox outlines in both light and dark modes does not meet WCAG AA guidelines for UI components. This PR increases the threshold for the shade and tint that are used the generate the outline color.
⭐ What else does this affect?
In order to increase the contrast ratios, I used the
euiFormCustomControlBorderColor
used with both SASS and Emotion.There should be no large visual differences with this change. This key affects the following components:
euiCustomControl
mixinContrast Details
**Before**After
Increase contrast ratio for
EuiSwitch
Body (#6692)The current contrast ratio for the switch toggle body in both light and dark modes does not meet WCAG AA guidelines for UI components. The
$euiSwitchOffColor
key was updated the adjust the background accordingly and increase the contrast ratio. I will say this is a stark difference because the ratio was super low.⭐ Just a note:
When disabled in light mode, the contrast ratio for the switch thumb on the switch body is low. Guidelines state that this is ok because it's disabled.
Contrast Details
**Before**QA
General QA
EuiCheckbox
outline andEuiSwitch
background should meet the suggested 3.0 contrast ratio.General checklist