Skip to content

Fix(carousel): Simplify scrolling logic to fix arrow buttons #2212

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Mahavishnu-K
Copy link

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 persistent EMFILE: 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

  1. Navigate to the /docs page.
  2. Scroll down to the "Show me some code" section.
  3. Click the right arrow button on the carousel.
  4. Expected behavior: The carousel smoothly slides to the next set of cards.
  5. Click the left arrow button.
  6. Expected behavior: The carousel smoothly slides back.

Contributor Checklist

  • I have read the Documentation Contributing Guide.
  • I was unable to complete the pnpm run build step due to a local environment issue (EMFILE). I am relying on the CI to validate the build.
  • My branch is up-to-date with the main branch of appwrite/website.

Removed complex state management for the carousel's scroll position. Replaced with a direct and reliable scrollBy(clientWidth) call to ensure smooth and predictable navigation.
Removed complex state management for the carousel's scroll position. Replaced with a direct and reliable scrollBy(clientWidth) call to ensure smooth and predictable navigation. Ajusted the whitespace for code readability
Copy link

appwrite bot commented Jul 24, 2025

appwrite.io

Project ID: 684969cb000a2f6c0a02

Sites (1)
Site Status Logs Preview QR
 website
68496a17000f03d62013
Failed Failed Authorize Preview URL QR Code

Note

You can use Avatars API to generate QR code for any text or URLs.

@coolify-appwrite-org
Copy link

coolify-appwrite-org bot commented Jul 24, 2025

The preview deployment is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-07-24 08:51:02 CET

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.

1 participant