Skip to content

fix(Carousel): intercept shift+wheel for discrete slide navigation#197

Merged
johnleider merged 1 commit into
masterfrom
fix/carousel-shift-wheel
Apr 21, 2026
Merged

fix(Carousel): intercept shift+wheel for discrete slide navigation#197
johnleider merged 1 commit into
masterfrom
fix/carousel-shift-wheel

Conversation

@johnleider
Copy link
Copy Markdown
Member

@johnleider johnleider commented Apr 21, 2026

Summary

  • Intercept wheel events on CarouselViewport only when Shift is held, call preventDefault, and step next()/prev() with a 300ms throttle.
  • Regular page scrolling over the carousel is untouched — the handler no-ops when shiftKey is false.

Context

Chrome's scroll-snap-type: x mandatory resists fast, continuous shift+wheel input: each tick gets absorbed by the snap, so rapid or direction-changing scrolls feel sluggish or get swallowed entirely. The same behavior is reproducible on MDN's reference scroll-snap carousel. Firefox is mostly fluid.

By bypassing the native wheel→scroll→snap pipeline for shift+wheel specifically and driving slide selection imperatively, one wheel tick = one slide, reliably.

Closes #193

Chrome's scroll-snap-type: mandatory absorbs each shift+wheel tick,
making fast or direction-changing scrolls feel ignored. Intercept the
event when Shift is held, preventDefault, and step next/prev with a
300ms throttle so one wheel tick moves exactly one slide.

Closes #193
@johnleider johnleider self-assigned this Apr 21, 2026
@johnleider johnleider added this to the v0.2.x milestone Apr 21, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 21, 2026

Open in StackBlitz

commit: 5829df7

@johnleider johnleider merged commit fbfed3a into master Apr 21, 2026
16 of 17 checks passed
@johnleider johnleider deleted the fix/carousel-shift-wheel branch April 21, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Carousel: shift + scroll is ignoring fast interactions and sometimes breaks alignment

1 participant