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] Horizontal rules, side navs, tabs, and breadcrumbs #8218

Merged
merged 8 commits into from
Dec 11, 2024

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Dec 10, 2024

Summary

Note

This PR merges into a feature branch

Breadcrumbs (specifically the EuiHeader/application styles) were mostly the headache here, as evidenced by the git history 🥲 I don't love the solution I went with and it has some minute color/pixel issues, but IMO it strikes a decent enough balance between providing sufficient visual contrast and maintaining headache-inducing CSS.

QA

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in both MacOS and Windows high contrast modes
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
      - [ ] Checked in mobile
  • 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

- this one I'm going to opt to just always show a border - it's not as potentially tricky as `<hr>` that tends to have native browser styling, and renders the same in non-high-contrast views
…x Windows rendering

- opt for pseudo element over box-shadow even in default contrast - it's easier and more targeted to set `border-color` over the entire repeated box shadow position
- switch to border over background for win high contrast rendering
- fix various token usages
- reduce className selector with `:is()`

- remove "default" clip path and unsetting said default with a specific key/modifier for intermediate children (will be using this shortly for high contrast styles as well)
- reduce selector nesting
- remove new drop shadow filter and make the focused item sit above the rest
@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

@cee-chen cee-chen marked this pull request as ready for review December 11, 2024 03:35
@cee-chen cee-chen requested a review from a team as a code owner December 11, 2024 03:35
`filter: drop-shadow(${euiTheme.border.width.thin} 0 0 ${
highContrastMode === 'forced' ? euiTheme.border.color : borderColor
});`;
const applicationHighContrastArrow = highContrastModeStyles(euiThemeContext, {
Copy link
Contributor

@mgadewoll mgadewoll Dec 11, 2024

Choose a reason for hiding this comment

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

Non blocking suggestion: We might be able to clean up the corners a bit by adjusting the clip-path for high contrast. 🤔
It might not be worth the override though.

// regular
clip-path: polygon(
    0 0,
    calc(100% - ${euiTheme.size.s}) 0,
    100% 50%,
    calc(100% - ${euiTheme.size.s}) 100%,
    0 100%,
    ${euiTheme.size.s} 50%
);
        
 // adjust position of arrow point by 1px (effectively making the gap bigger but by that also preventing the clip-path to include another items drop-shadow)
 const additionalOffset = euiTheme.border.width.thin;
 const offset = mathWithUnits([euiTheme.size.s, additionalOffset], (x, y) => x - y);
 clip-path: polygon(
    0 0,
    calc(100% - ${offset}) 0,
    100% 50%,
    calc(100% - ${additionalOffset}) 100%,
    0 100%,
    ${euiTheme.size.s} 50%
);

current
Screenshot 2024-12-11 at 12 04 09

suggested
Screenshot 2024-12-11 at 12 10 22

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha dangit that's going to bug me forever now. Buuut I think I'm just going to ship it with the imperfection, the drop-shadow filter workaround is also slightly off on Windows high contrast (since it uses the full/empty shade and can't inherit the theme's border color) so I don't really want to add a bunch of code to try and fix barely perceptible/minor issues.

Honestly I'd prefer we just move away from this style of breadcrumbs. It sounds like we may be doing with the new serverless nav eventually, as those use non-application type breadcrumbs, so at some point this display style will get deprecated and we won't need to worry about this 🤞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I forgot to also comment - super impressive CSS-fu figuring out the fix though!! 👏

Copy link
Contributor

@mgadewoll mgadewoll Dec 11, 2024

Choose a reason for hiding this comment

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

Honestly I'd prefer we just move away from this style of breadcrumbs. It sounds like we may be doing with the new serverless nav eventually, as those use non-application type breadcrumbs, so at some point this display style will get deprecated and we won't need to worry about this.

That's a fair point. I agree that it's not needed to optimize now if it potentially becomes obsolete in the future. And if not, we can still update as needed when needed. 👍

@cee-chen cee-chen merged commit cee7e17 into elastic:high-contrast-mode Dec 11, 2024
5 checks passed
@cee-chen cee-chen deleted the high-contrast-mode-6 branch December 11, 2024 17:02
@cee-chen cee-chen mentioned this pull request Dec 12, 2024
10 tasks
mgadewoll pushed a commit to mgadewoll/eui that referenced this pull request Mar 14, 2025
mgadewoll pushed a commit to mgadewoll/eui that referenced this pull request Mar 18, 2025
mgadewoll pushed a commit to mgadewoll/eui that referenced this pull request Mar 18, 2025
mgadewoll pushed a commit to mgadewoll/eui that referenced this pull request Mar 20, 2025
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