The carousel plugin in the Preline project is not working correctly in RTL (Right-To-Left) mode. While the first slide displays correctly, moving to the next slide results in a blank screen.
Steps to Reproduce
Initialize the carousel in RTL mode.
Observe the first slide displaying correctly.
Move to the next slide.
Notice the blank slide.
Expected Result
The carousel should display slides correctly in RTL mode, just as it does in LTR (Left-To-Right) mode.
Actual Result
The first slide shows up correctly, but subsequent slides are blank.
After investigating, I found that the issue lies in how the CSS transform is calculated. The current implementation always assumes that repositioning will be to the left, as indicated by the negative sign in the transform calculation:
Description
The carousel plugin in the Preline project is not working correctly in RTL (Right-To-Left) mode. While the first slide displays correctly, moving to the next slide results in a blank screen.
Steps to Reproduce
Expected Result
The carousel should display slides correctly in RTL mode, just as it does in LTR (Left-To-Right) mode.
Actual Result
The first slide shows up correctly, but subsequent slides are blank.
Environment
Root Cause Analysis
After investigating, I found that the issue lies in how the CSS transform is calculated. The current implementation always assumes that repositioning will be to the left, as indicated by the negative sign in the transform calculation:
Proposed Solution
Add an argument isRTL to the constructor and use it to determine the correct direction (sign) for the transform calculation. For example:
Additional Information Here's my package.json for reference: