brainhubeu / react-carousel

A pure extendable React carousel, powered by Brainhub (craftsmen who ❤️ JS)

Home Page:https://brainhub.eu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Carousel scrolls by itself when re-rendered, using infinite option

sudravi opened this issue · comments

Describe the bug
The CodeSandbox below demonstrates the problem. It has two tabs, one with Carousel and one blank. If you switch between tabs, you'll notice the tab with Carousel scrolls by itself when it's re-rendered. This only happens with the infinite option enabled.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/react-carousel-forked-y5ii2
  2. Click on 'Tab2' and click back to 'Tab1'
  3. See scrolling behavior

Expected behavior
Don't expect any scrolling to happen by itself.

Screenshots
None

Environment

  • please paste the result of npx envinfo --system --binaries --browsers --npmPackages '@brainhubeu/*'
  • System:
    OS: macOS 11.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 393.52 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
    Binaries:
    Node: 14.15.3 - ~/.nvm/versions/node/v14.15.3/bin/node
    npm: 6.14.9 - ~/.nvm/versions/node/v14.15.3/bin/npm
    Browsers:
    Chrome: 87.0.4280.88
    Safari: 14.0.2
    npmPackages:
    @brainhubeu/react-carousel: ^2.0.2 => 2.0.2
  • desktop
  • Browser Chrome

Same problem here