Skip to content

feat: [FIND-7602] Enhanced slide transition to work for multiple slides#91

Merged
chinrichs-godaddy merged 2 commits intogodaddy:mainfrom
ali2-godaddy:fix-left-translation
Feb 12, 2026
Merged

feat: [FIND-7602] Enhanced slide transition to work for multiple slides#91
chinrichs-godaddy merged 2 commits intogodaddy:mainfrom
ali2-godaddy:fix-left-translation

Conversation

@ali2-godaddy
Copy link
Contributor

@ali2-godaddy ali2-godaddy commented Feb 4, 2026

Summary

Enhanced the slide transition so that goToSlide works for multiple slides at a time when looping left or right. Previously there was a bug with goToSlide where when looping around left, the offset would be incorrect and cause the animation to look incorrect. This fixes that issue and enforces the use of the direction argument when looping the slider around left or right.

Changelog

Enhanced the slide transition so that goToSlide respects the direction prop and works for transitioning multiple slides at a time when infinite is set to true.

Also enhanced jsdom to mock viewport width and height for tests.

Test Plan

Added unit tests for calcLeftOffset for various scenarios and conducted manual testing of infinite and non-infinite scrolling cases.

Before:

Video.Project.9.mp4

After:

Video.Project.9.mp4

@jsanthosh-godaddy
Copy link
Collaborator

@ali2-godaddy : Can you please include some screenshots/recordings of the change?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the carousel's slide transition logic to properly handle multi-slide transitions in infinite scroll mode, particularly when looping around the carousel boundaries. The changes fix a bug where the goToSlide function would incorrectly calculate offsets when looping left, and enforce the use of the direction argument for proper animation behavior.

Changes:

  • Fixed offset calculation in calcLeftOffset to detect and handle looping transitions
  • Added logic to use clone slides for smooth wrapping animations
  • Refactored code formatting and style consistency throughout the codebase
  • Enhanced test setup to mock viewport dimensions for more accurate testing

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/unit/carousel.tests.js Removed old test file (renamed to .test.jsx)
test/unit/carousel.test.jsx Renamed from .tests.js with added tests for calcLeftOffset scenarios including looping transitions
test/setup.js Added jsdom mocks for offsetWidth and offsetHeight to enable viewport testing
src/stories/CustomArrows.js Fixed missing semicolon
src/index.js Enhanced calcLeftOffset with looping detection logic, formatted code, and updated stopDragging to set transitioningFrom
package.json Updated test commands and added jsdom-testing-mocks dependency
.mocharc.json Added mocha configuration file with test setup requirements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jsanthosh-godaddy
Copy link
Collaborator

@ali2-godaddy : Was wondering if we can make the card height of the cards in the carousal the same ?
In the recording they don't look the same

@ali2-godaddy ali2-godaddy force-pushed the fix-left-translation branch 5 times, most recently from a668850 to 11a2292 Compare February 11, 2026 16:10
@ali2-godaddy
Copy link
Contributor Author

@ali2-godaddy : Was wondering if we can make the card height of the cards in the carousal the same ? In the recording they don't look the same

This can be configured by setting the slideHeight prop.

@ali2-godaddy ali2-godaddy force-pushed the fix-left-translation branch 5 times, most recently from 65d93f4 to 709dfbf Compare February 11, 2026 22:40
Copy link
Collaborator

@jsanthosh-godaddy jsanthosh-godaddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Please get approval from Chris as well.

vitest.config.js Outdated
environment: 'happy-dom',
setupFiles: './test/setup.js',
include: ['test/**/*.tests.{js,jsx}'],
include: ['test/**/*.test.{js,jsx}'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Since you are renaming the carousel.test.jsx test with this PR, this field can actually be removed. Now it matches the default Vitest setup.

Example

Image
Suggested change
include: ['test/**/*.test.{js,jsx}'],

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, addressed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ali2-godaddy — I noticed this package-lock.json change points the registry back to Artifactory. Since this package is open source, public consumers won’t be able to install it if the lockfile references Artifactory.

Could we reset the lockfile to main and re-apply the updates using npm as the registry?

Steps that should work:

  1. git reset origin/main package-lock.json

  2. Temporarily use the public npm registry (without changing your global config):

    npm install --registry=https://registry.npmjs.org/ --package-lock-only
    
  3. Voilà. Now you can check in the updated package-lock.json, which should reference npm as the registry.

This shouldn’t change anything for internal consumers — running npm internally will still use Artifactory as the configured registry, which proxies and caches npmjs automatically.

Copy link
Contributor

@chrisvogt chrisvogt Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW—This is probably the only comment of mine that should block anything, because if published as is, non-GoDaddy consumers who download this package won't be able to install it unless they delete or ignore the package lock file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh yea, good point. I think I might have missed this step in my previous PR as well 🤦

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

@ali2-godaddy ali2-godaddy force-pushed the fix-left-translation branch 2 times, most recently from dbbfb5c to 1ba9eea Compare February 12, 2026 14:46
@ali2-godaddy ali2-godaddy force-pushed the fix-left-translation branch 2 times, most recently from 0d249f5 to 9fff670 Compare February 12, 2026 20:16
@chinrichs-godaddy chinrichs-godaddy merged commit 2711307 into godaddy:main Feb 12, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

4 participants