Skip to content

Replacing the last item in a scrollable container with flip animation results in wrong scroller position #4726

@isaacHagoel

Description

@isaacHagoel

Describe the bug
When replacing the last item in a list (#each block) that is inside of a scrollable parent,
While the scroller position is at the bottom of said scrollable container (the last item is visible),
and using flip animation,
the container scrolls up to the one before last item automatically instead of staying put and showing the last item.

Logs
N/A

To Reproduce
https://svelte.dev/repl/2ec547f272a840639d7e483f49de3a38?version=3.21.0.
(instructions inside, basically scroll the list down and click the button)

Expected behavior
the scroll position should stay at the bottom of the container, showing the last item.

Stacktraces
N/A

Information about your Svelte project:

  • Your browser and the version: Chrome 81.0.4044.113, Firefox 75.0

  • Your operating system: Mac OS Catalina 10.15.4

  • Svelte version (Please check you can reproduce the issue with the latest release!)
    verified with 3.2.1

  • Whether your project uses Webpack or Rollup
    Rollup

Severity
I have found a workaround: rather than replacing the element and the id, i keep the old id.
It is sufficient for my needs, therefore I would say that the priority for me is low.
Still, this might point to a deeper issue with the animation system

Additional context
Thanks :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions