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

use CSS transitions and transforms in horizontal scroll #5193

Merged
merged 9 commits into from
Oct 12, 2021

Conversation

radium-v
Copy link
Collaborator

@radium-v radium-v commented Sep 16, 2021

Pull Request

📖 Description

  • Converts the scrolling animation for the horizontal scroll component to use CSS transitions and transforms.
  • Moves ResizeObserver and IntersectionService files to src/utilities in fast-foundation
  • Adds parts to internal components of the horizontal scroller template

🎫 Issues

👩‍💻 Reviewer Notes

The first approach used requestAnimationFrame to approximate the screen refresh rate. This new approach uses CSS transforms in conjunction with scrolling to transition the contents into place. On transitionend, we then set scrollLeft on the same frame that we remove the transform. The key is that the transition-duration is set to 0s while this happens.

📑 Test Plan

Tested in Chrome, Edge, and Firefox at 60hz, 120hz, 165hz, and 240hz.

✅ Checklist

General

  • I have included a change request file using $ yarn change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

@@ -45,7 +46,7 @@ export const horizontalScrollTemplate: FoundationElementTemplate<
part="scroll-prev"
${ref("previousFlipperContainer")}
>
<div class="scroll-action">
<div class="scroll-action" part="scroll-action-previous">
Copy link
Member

Choose a reason for hiding this comment

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

This is great - thank you!

Copy link
Member

@chrisdholt chrisdholt 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 this @radium-v!

@chrisdholt
Copy link
Member

Also, I pulled this down, built, smoked - definitely smoother on my mac :)

Copy link
Contributor

@eljefe223 eljefe223 left a comment

Choose a reason for hiding this comment

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

Smooth like butter, Thanks for doing this John!

@radium-v radium-v force-pushed the users/jokreitl/horizontal-scroll-screen-refresh branch 2 times, most recently from 82f742a to a8d464b Compare September 30, 2021 19:27
@radium-v radium-v force-pushed the users/jokreitl/horizontal-scroll-screen-refresh branch from a8d464b to 2d9461e Compare October 11, 2021 17:10
@radium-v radium-v force-pushed the users/jokreitl/horizontal-scroll-screen-refresh branch from f33a2c4 to 19d002d Compare October 12, 2021 00:50
@radium-v radium-v changed the title calculate monitor refresh rate in horizontal-scroll use CSS transitions and transforms in horizontal scroll Oct 12, 2021
@radium-v radium-v force-pushed the users/jokreitl/horizontal-scroll-screen-refresh branch from 19d002d to fbc3686 Compare October 12, 2021 01:01
@radium-v radium-v force-pushed the users/jokreitl/horizontal-scroll-screen-refresh branch from fbc3686 to b6719f4 Compare October 12, 2021 20:30
@chrisdholt chrisdholt merged commit 6644314 into master Oct 12, 2021
@chrisdholt chrisdholt deleted the users/jokreitl/horizontal-scroll-screen-refresh branch October 12, 2021 20:53
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.

5 participants