-
Notifications
You must be signed in to change notification settings - Fork 503
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
Fix carousel failing to lock to remainder slides #303
Conversation
fix carousel bug
Hi @quinnlangille, I notice that you maintain this repo - any chance you might be able to take a look at this PR? I see that you have opened #274 for discussing a refactor of the logic entirely - seems great. Though, since our team uses this component in production it'd be wonderful to merge in this fix even in advance of that if you are open to that. |
Lgtm! Thanks for the fix, it was a serious issue. I’ll leave the current issue open, as a full rewrite of the logic is definitely needed but this is a great patch in the mean time! |
Regarding your email, I’ve merged this into the current working branch and will release as an rc as soon as possible! |
Unreal thanks! |
* feat(standard): adding touchDrag prop to block touch dragging (#296) * feat(standard): adding touchDrag prop to block dragging on mobile devices * feat(standard): adding touchDrag prop to block dragging on mobile devices - removing package-lock.json * adding line-break space to end of file * chore(build): release for rc1 * v0.16.0-rc1 * Fix carousel failing to lock to remainder slides (#303) * Update Carousel.vue fix carousel bug * Added a looping autoplay to the Story page. (#305) * docs(readme): updated README configuration section (#304) * v0.16.0-rc2 * fix: rename event slideClick to slideclick in Slide.vue (#311) * fix: rename event slideClick to slideclick * fix(slide): disable tap highlight in Mobile Safari (#326) * fix(slide): disable tap highlight in Mobile Safari * feat: add correct calculation for pageCount (#329) * chore: build
Fix locking issue #243
Description
Previously, the carousel would calculate offset and lock it to an exact multiple of
slideWidth * currentPerPage
.For example, say we had 7 slides with 3 per page with 1 extra slide, it would only lock to display slides 1 - 3, 4 - 6, and when on 5 - 7 and the screen was tapped, it would revert to 4 - 6 due to improper offset handling.
This was solved by ensuring that the remainder slides (5 - 7 in this example) is a valid position for the carousel to lock into.
Motivation and Context
It solves #243
To replicate the bug fix, add an extra slide to the Vue Play examples (so it doesn't divide evenly by currentPerPage). Now, tapping on the final slide when the carousel is all the way over will not cause it to lock back to the previous page. Whereas previously, as per the issue solved here, that would occur.
How Has This Been Tested?
Vue Play was used to test the behaviour of the component.
Screenshots (if appropriate):
N/A
Types of changes
Checklist:
Credit also to @noahlafferty