Skip to content
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

Merged
merged 11 commits into from
Dec 2, 2024

Conversation

cee-chen
Copy link
Member

@cee-chen cee-chen commented Nov 27, 2024

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

  • Browser QA
    • Checked in both light and dark modes
    • Checked in both MacOS and Windows high contrast modes
      • (emulate forced colors if you do not have access to a Windows machine.)
        - [ ] Checked in Chrome, Safari, Edge, and Firefox
        - [ ] Checked in mobile
        - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA - N/A
  • Code quality checklist
    - [ ] Added or updated jest and cypress tests
  • Release checklist - N/A, feature branch
  • Designer checklist - N/A

@cee-chen cee-chen force-pushed the high-contrast-mode-4 branch from 200dae3 to 827a36f Compare November 27, 2024 18:55
+ 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
@cee-chen cee-chen force-pushed the high-contrast-mode-4 branch from 827a36f to 737cb08 Compare November 27, 2024 23:59
@cee-chen cee-chen marked this pull request as ready for review November 28, 2024 00:33
@cee-chen cee-chen requested a review from a team as a code owner November 28, 2024 00:33
@mgadewoll mgadewoll self-assigned this Nov 28, 2024
// 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`;
Copy link
Member Author

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(
Copy link
Contributor

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.

Copy link
Member Author

@cee-chen cee-chen Dec 2, 2024

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/toast/toast.styles.ts Outdated Show resolved Hide resolved
@cee-chen cee-chen force-pushed the high-contrast-mode-4 branch from 737cb08 to 036e2a9 Compare December 2, 2024 16:43
: // 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 {
Copy link
Contributor

@mgadewoll mgadewoll Dec 2, 2024

Choose a reason for hiding this comment

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

This changes the design slightly, but imho it's a minor change and has the added benefit of actually being more visible 👍

Screenshot 2024-12-02 at 18 32 35
Screenshot 2024-12-02 at 18 33 02

Copy link
Member Author

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!)

@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

Copy link
Contributor

@mgadewoll mgadewoll left a 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 🎉

@cee-chen cee-chen merged commit 91f3f91 into elastic:high-contrast-mode Dec 2, 2024
4 checks passed
@cee-chen cee-chen deleted the high-contrast-mode-4 branch December 2, 2024 18:06
cee-chen added a commit that referenced this pull request Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants