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

[Emotion] Converted EuiLoadingChart #5821

Merged
merged 15 commits into from
Apr 25, 2022

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Apr 19, 2022

Summary

  • Converted margins to use either gap or logical property
  • Tried adding renderWithStyles() in test (commented out for now)
  • Uses Emotion keyframes
  • Cleaned up classes and using for loop for bars

Okay descrepencies (See screenshot below)

  1. By using a function based on index, the math was simpler to adjust the non-animated version to trend downward instead of upward.
  2. By switching to the gap property, the first bar no longer as an added margin left so all the loaders a slightly skinnier and sit better in their full bounds.

image

Helper adjustments / additions

  • Added tintOrShade and shadeOrTint functions
  • Updated canAnimate functions to accept and return the css object (@thompsongl to look into this further)

Checklist

  • Checked in both light and dark modes
  • [ ] Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • [ ] Props have proper autodocs and playground toggles
  • [ ] Added documentation
  • [ ] Checked Code Sandbox works for any docs examples
  • Added or updated jest and cypress tests
  • [ ] Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • Updated the Figma library counterpart
  • A changelog entry exists and is marked appropriately

cchaos added 5 commits April 19, 2022 13:42
- Added tintOrShade and shadeOrTint functions
- Converted margins to use either `gap` or logical property
- Couldn’t convert `keyframes` yet
- Updated `canAnimate` functions to accept and return the css object
@cchaos cchaos changed the title [Emption] Converted EuiLoadingChart [Emotion] Converted EuiLoadingChart Apr 19, 2022
@cchaos
Copy link
Contributor Author

cchaos commented Apr 19, 2022

Things to look out for when moving styles

  • Anything in the backlog that could be a quick fix for that component? [EuiLoading] Accessibility props #4814
  • Convert global Sass vars to JS version like sizing
  • [ ] Convert component-specific Sass vars to exported JS versions
  • Convert side specific padding, margin, and position to -inline and -block (Logical properties)
  • Reduce specificity where possible (usually by reducing class name chaining)
  • Use gap property to add margin between items if using flex
  • [ ] Can any still existing .js files be converted to TS?

QA

  • Do className, css, and style props work properly when passed by the consumer
  • Does the rendered class read as expected

@cchaos
Copy link
Contributor Author

cchaos commented Apr 19, 2022

@1Copenut I've updated a few props on this specific loading component according to this ticket: #4814

  • Added role="progressbar"
  • Added default aria-label="Loading"

I didn't do the full documentation or any of the children bit since that's more involved. But wanted to get you approval on this iterative chage.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5821/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5821/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5821/

Copy link
Contributor

@miukimiu miukimiu left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

Tested in Chrome, Safari, and Firefox. Also tested with reduce motion turned on.

src/services/color/manipulation.ts Outdated Show resolved Hide resolved
@cchaos cchaos requested a review from 1Copenut April 20, 2022 20:51
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5821/

Copy link
Contributor

@1Copenut 1Copenut left a comment

Choose a reason for hiding this comment

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

LGTM! I added one review comment as a thought that I'll develop into a full ticket shortly.

<span
className={classes}
css={cssStyles}
role="progressbar"
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with this iterative approach. Adding the role="progressbar" and aria-label="Loading" give clues that content is being fetched async. This technique assumes screen reader users are navigating node to node, using the virtual/browse mode. Users navigating by focus with the TAB key will not land on the loading indicator. Users who are listening for cues via live regions will also never hear this information.

I'm going to open a spike ticket to explore this concept in a future breaking change. I'd like to see us use the aria-busy attribute and move to a role="status" for these loading indicators. That way screen readers will announce changes as a live region without requiring us to manage focus or users to seek them out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🙌 Thank you! I'm converting the rest of the loading components too. Should I add these same properties?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, let's add the role="progressbar" and aria-label="Loading" consistently. Great call!

…ding_chart

# Conflicts:
#	src/global_styling/variables/_animations.ts
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5821/

@cchaos cchaos enabled auto-merge (squash) April 25, 2022 19:16
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5821/

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.

None yet

4 participants