-
Notifications
You must be signed in to change notification settings - Fork 843
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
[High Contrast Mode] Form controls #8193
[High Contrast Mode] Form controls #8193
Conversation
200dae3
to
827a36f
Compare
+ add borders to prepend/append labels - contrast feels low otherwise, especially for disabled inputs
- always set a border (even if transparent) for Windows high contrast themes
- have to use `empty` instead of `dot` as Windows will always render the `dot` + VRT
- compressed modes in particular require a windows forced contrast mode override - since they have no icon, users have literally no way of telling what on/off state is without it
- increase size in all high contrast modes - use inline SVG workaround (sadly necessarily) for Windows high contrast mode - remove form background tint on all high contrast modes for better consistency + add VRT screenshots for focus state, dark mode
827a36f
to
737cb08
Compare
// so to restore the linear-gradient that provides important visual information, we're | ||
// using a static inline SVG workaround | ||
const fill = encodeURIComponent(color); | ||
const inlineSVG = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='${fill}' /%3E%3C/svg%3E`; |
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.
Worth mentioning - unfortunately we can't use the forced-color-adjust: none
workaround here that EuiToast uses, because that affects more than just the underline - it also affects the background/text/placeholder colors with fairly significant deviance from high contrast themes.
), | ||
borderColor: highContrastMode | ||
? euiTheme.border.color | ||
: transparentize( |
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.
General Borealis note for any occurrences: color manipulations/calculations were removed in Borealis and will be replaced by tokens.
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 believe we can use transparentize(color, 1)
to remove all transparency from color values.
packages/eui/src/components/form/form_control_layout/form_control_layout_clear_button.styles.ts
Outdated
Show resolved
Hide resolved
737cb08
to
036e2a9
Compare
: // Windows high contrast mode ignores/overrides border colors, which have semantic meaning here. To get around this, we'll use a pseudo element that ignores forced colors | ||
`overflow: hidden; | ||
|
||
&::before { |
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 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.
Right, yes, this should only affect high contrast mode as well (as extra visibility is the point!)
Preview staging links for this PR:
|
💚 Build Succeeded
History
cc @mgadewoll |
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.
🚢 🐈⬛ Thanks for the explanations and additional updates! The changes look good to me and it's working great now 🎉
Summary
Note
This PR merges into a feature branch.
This PR primarily handles the basic form controls and selection controls. I recommend following along by commit and viewing the VRT screenshots.
It does not tackle advanced form controls like date picker, color picker, etc. (except for random border / shade issues I grepped for).
It does randomly grab some more EuiToast contrast improvements while here because the stateful color gradient work reminded me of it 😅
QA
General checklist
- [ ] Checked in Chrome, Safari, Edge, and Firefox- [ ] Checked in mobile- [ ] Checked for accessibility including keyboard-only and screenreader modes- [ ] Added or updated jest and cypress tests