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

Dot navigation breaks when carousel has less items than set #103

Closed
benhodgson87 opened this issue Nov 14, 2019 · 3 comments
Closed

Dot navigation breaks when carousel has less items than set #103

benhodgson87 opened this issue Nov 14, 2019 · 3 comments

Comments

@benhodgson87
Copy link
Contributor

Describe the bug
Dot navigation breaks when carousel contains less items than set in the responsive prop.

To Reproduce

  1. Set slider to show 4 items at once
  2. Add 2 items to slider
  3. Should show 2 items, aligned to left, with single inactive dot
  4. Clicking dot is still possible, which causes items to slide to the right, and sets dot to active
showDots={true}
responsive={{
  desktop: {
    breakpoint: { max: 4096, min: 721 },
    items: 4,
    slidesToSlide: 4
  },
  mobile: {
    breakpoint: { max: 720, min: 0 },
    items: 2,
    slidesToSlide: 2
  }
}}

Nov-14-2019 11-57-17

Expected behavior
If there aren't enough items currently visible at a breakpoint to show more than one slide, the dots should either be hidden as navigation/showing the user where they are is unnecessary, or the button should be disabled.

eg. <button disabled={carouselState.totalItems <= carouselState.slidesToShow}>

Desktop:

  • OS: OSX
  • Firefox 69
  • Chrome 77
@benhodgson87
Copy link
Contributor Author

benhodgson87 commented Nov 14, 2019

Also just tested this with infinite={true} set and seeing a completely different bug.

Instead of the dot being inactive, it is active, but clickable. Clicking it causes the slides to completely disappear. Clicking the button again does nothing.

Looking at where devtools is showing the render happening, it looks like the two slides are off to the left after the click, but don't get brought back.

Nov-14-2019 12-19-21

Expected behaviour outlined above (disable/hide dots when not needed) would I think also avoid this.

YIZHUANG pushed a commit that referenced this issue Nov 18, 2019
[#103] Do not render default dots if only one slide
@benhodgson87
Copy link
Contributor Author

Resolved by #104

@YIZHUANG
Copy link
Owner

It's now in 2.4.1

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

No branches or pull requests

2 participants