-
-
Notifications
You must be signed in to change notification settings - Fork 105
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(issue180): handling invalid clickedIndex in carousel.js #187
fix(issue180): handling invalid clickedIndex in carousel.js #187
Conversation
Point of information. Using the parentheses makes it more obvious, but the modulo operator still has higher precedence so mathematically there is no difference.
… On Sep 18, 2021, at 9:13 AM, Daniel Wurzer ***@***.***> wrote:
@wuda-io commented on this pull request.
In js/carousel.js <#187 (comment)>:
> @@ -608,7 +623,7 @@
* @param {Function} callback
*/
_cycleTo(n, callback) {
- let diff = this.center % this.count - n;
+ let diff = (this.center % this.count) - n;
I think it should be fine because it is modulo and not divide operator.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#187 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAA62YNMDEUXDKQJQ6CV5ILUCS3DZANCNFSM5EB664UA>.
|
6d71c21
to
e8384f5
Compare
Please see the failing commitlint check. We use commitlint-conventional: https://github.com/conventional-changelog/commitlint#what-is-commitlint So something like |
In the carousel, navigating by clicking : - at right when the selected item is the last - at left when the selected item is the first causes the clickedIndex to be invalid and breaks the component.
… modified by my code editor this commit applies this review comment : #187 (comment)
…rt of the code fixes this commit applies this review comment : #187 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awaiting approval
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, I took too long to review, thanks for the PR and everyone that reviewed this PR 👍 Anyway, I sent an invitation to you to join the @materializecss/members team. Welcome 🎉 |
In the carousel, navigating by clicking :
causes the clickedIndex to be invalid and breaks the component.
Proposed changes
Solves #180 (and also Dogfalo#6459), all changes are explained here
Screenshots (if appropriate) or codepen:
see Dogfalo#6459 (comment)
Types of changes
Checklist:
I didn't tested nor created test because :
yarn test --verbose --filter=carousel
took way too much time in my laptop.