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

Flush drop animation if there is a scroll event #1104

Closed
Nathan-Fenner opened this issue Feb 12, 2019 · 5 comments
Closed

Flush drop animation if there is a scroll event #1104

Nathan-Fenner opened this issue Feb 12, 2019 · 5 comments

Comments

@Nathan-Fenner
Copy link

Bug or feature request?

Bug

Expected behavior

Dropped items animate to their final resting place, regardless of scroll.

Actual behavior

Dropped items animate to fixed point on screen, then jump to final resting place.

This is noticeable when scrolling right after / during the drop.

Steps to reproduce

Example Storybook

  • start dragging an item
  • drop the item and immediately scroll downward quickly

The item will noticeably stick to its place in the screen. Then it will disappear when the animation completes.

I would expect the item to be animating with position: relative towards an offset of 0, 0, so that it naturally settles where it's going to end up. Instead, it animates to where it would end up on screen if the viewport doesn't scroll. That means if you do scroll, it animates towards the wrong place.

When the animation ends, it jumps to the right location, so this is only an issue during the animation.

(it makes sense that it would be fixed while actually being dragged, but as soon as the user releases the item it should be drawn with position: relative instead, in my mind).

What version of React are you using?

16.8.0, but doesn't seem to matter.

What browser are you using?

Chrome (71.0.3578.98)

@alexreardon
Copy link
Collaborator

Unfortunately I don't think we will be able to use position:relative here for layering and other issues.

We could improve the experience by flushing the drop animation if we detect a scroll. That way if there is a scroll during a drop animation the drop animation will fast forward to the end immediately. I think this is an okay compromise

Thoughts @Nathan-Fenner ?

@Nathan-Fenner
Copy link
Author

It would be nice if the animation still worked, but snapping to destination would probably be fine too.

Would it be possible to instead update the animation position on scroll?

Really, the problem is that the animation's start & end become "stale" on scrolling, since the place that they're moving from/to are no longer the same.

Could these parameters be recomputed on scroll instead, and the item's location updated? Would that be too expensive?

@alexreardon
Copy link
Collaborator

Anything is possible, but i am not sure the complexity is worth it. Also, if a scroll is occurring then we might need to worry about animation interuption and completion which could look janky given we are using css animations and not a js animation library for the drop animation

@alexreardon
Copy link
Collaborator

I think the fast forwarding of the drop animation is the best course

@alexreardon alexreardon changed the title items stuck to screen during drag-end animation (noticeable while scrolling) Flush drop animation if there is a scroll event Mar 12, 2019
@alexreardon
Copy link
Collaborator

This is available in 12.0.0-alpha.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants