-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Navigator: hide scrollbars while animating
#35317
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
Navigator: hide scrollbars while animating
#35317
Conversation
| push( path, options ) { | ||
| setPath( { path, ...options } ); | ||
| setIsAnimating( true ); | ||
| setNavigatorPath( { path, ...options } ); |
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.
This approach seems to work better than using the onAnimationStart callback on the motion.div component:
- in my tests, the
onAnimationStartcallback would fire after the animation starts, which caused the scrollbars to still appear from time to time (depending on the browser rendering loop) - setting
isAnimatingtotruein thepushfunction ensures that the flag is applied before the animation starts
|
Size Change: +113 B (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
stokesman
left a comment
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.
This works well but I'm not sure it wouldn't be better to simply add overflow-x: hidden unconditionally to the root of the component.
packages/components/src/navigator/navigator-provider/component.tsx
Outdated
Show resolved
Hide resolved
d0e3e85 to
0c21e52
Compare
0c21e52 to
5a17e72
Compare
|
Addressed the initial round of feedback and rebase on top of |
|
Hey @youknowriad @diegohaz @mirka @ntsekouras and @jorgefilipecosta, I'd love to hear your opinion about the approach taken in this PR and how it compares against #35332.
What do you think? We could, for example, opt for the simpler solution #35332 and come up with a more elaborate solution only if necessary |
|
The advantage I see here is less about popovers (they should be portal'ed anyway like @stokesman says in #35332 (comment)), but in scenarios where the consumer inadvertently causes x-overflows with naive CSS and dynamic content (translations, tables, etc). This isn't an uncommon occurrence, so in those cases I would want the overflow to be at least scrollable. I find the slightly added complexity to be an acceptable trade off for that tolerance. |
That is a fair point. @stokesman has updated #35332 to potentially address this issue as well. With regards on how to proceed, I'm happy with both solutions (given that they solve the issue equally well). I'm happy to follow whatever decision is made here. |
|
Let's go with #35332 for now |
Description
This PR builds on top of #35214 and proposes a fix for the issue raised in #34904 (review) about the scrollbars appearing during screen animations.
The proposed solution applies the
overflow: hiddenstyles on theNavigatorProviderwrapper only while screens are animating (which addresses the concerns expressed in #35214 (comment)).The main changes are:
NavigatorContextfrom array to object, in order to include theisAnimating/setInsAnimatingprops.isAnimating/setInAnimatingprops, apply theoverflow: hiddenstyles to the wrapperdivonly while an animation is in progress.Flyoutto show that the overflow rule doesn't affect modalsHow has this been tested?
animationEnterDurationandanimationExitDurationvariables could be changed to a higher value (e.g.5).Screenshots
Before
navigator-scrollbars.mp4
After
Kapture.2021-10-04.at.12.32.46.mp4
Types of changes
Bug fix
Checklist:
*.native.jsfiles for terms that need renaming or removal).