Fix(carousel): Simplify scrolling logic to fix arrow buttons #2212
+2
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
This pull request fixes a bug in the
Carousel.svelte
component where the arrow buttons were not working correctly.The original implementation used complex and unreliable state management to calculate the scroll distance. This fix simplifies the logic entirely by removing the manual scroll tracking and using a direct
carousel.scrollBy({ left: carousel.clientWidth })
call. This approach is more robust, simpler to maintain, and ensures the carousel scrolls as expected.Local Build Environment
The contribution guide asks to run
pnpm run build
before submitting. Unfortunately, I was unable to get a successful build on my local Windows machine due to a persistentEMFILE: too many open files
error, which is a known OS limitation with very large projects. I have made several attempts to resolve it (memory increase, clean installs) without success.As this change is a small, self-contained UI fix to a single component, I am confident it will not break the production build, which will be verified by the CI pipeline.
How to Test
/docs
page.Contributor Checklist
pnpm run build
step due to a local environment issue (EMFILE
). I am relying on the CI to validate the build.main
branch ofappwrite/website
.