Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ web-sys = { version = "0.3", default-features = false, features = [
"Navigator",
"Node",
"NodeList",
"ScrollBehavior",
"ScrollToOptions",
"Request",
"RequestInit",
"RequestMode",
Expand Down
9 changes: 4 additions & 5 deletions app_crates/registry/src/hooks/use_card_carousel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::cell::RefCell;

use wasm_bindgen::JsCast;
use wasm_bindgen::closure::Closure;
use web_sys::{Element, Event, EventTarget, ScrollBehavior, ScrollToOptions};
use web_sys::{Element, Event, EventTarget};

const CAROUSEL_ROOT: &str = r#"[data-name="CardCarousel"]"#;
const CAROUSEL_TRACK: &str = r#"[data-name="CardCarouselTrack"]"#;
Expand Down Expand Up @@ -68,10 +68,9 @@ fn handle_click(event: Event) {
let is_prev = buttons.item(0).and_then(|n| n.dyn_into::<Element>().ok()).is_some_and(|first| first == btn);

let delta = f64::from(track.client_width()) * if is_prev { -1.0 } else { 1.0 };
let opts = ScrollToOptions::new();
opts.set_left(delta);
opts.set_behavior(ScrollBehavior::Smooth);
track.scroll_by_with_scroll_to_options(&opts);
// No explicit behavior — CSS scroll-smooth on the track handles the animation,
// and avoids a known WebKit bug where behavior:'smooth' breaks snap-mandatory.
track.scroll_by_with_x_and_y(delta, 0.0);
}

// ── Scroll handler ────────────────────────────────────────────────────────────
Expand Down