A platform for community discussion. Free, open, simple.
UX: Fix image carousel number jitter (#43619)
Martin Brennan659dfe17bce6
diff --git a/frontend/discourse/app/components/image-carousel.gjs b/frontend/discourse/app/components/image-carousel.gjsindex 2f920edd79a..a543f662479 100644--- a/frontend/discourse/app/components/image-carousel.gjs+++ b/frontend/discourse/app/components/image-carousel.gjs@@ -21,7 +21,6 @@ const getAspectRatio = helper(([width, height]) => {});const KEYBOARD_THROTTLE_MS = isTesting() ? 0 : 150;-const SCROLL_THROTTLE_MS = 50;const MAX_DOTS = 10;export default class ImageCarousel extends Component {@@ -38,6 +37,7 @@ export default class ImageCarousel extends Component {this.#trackDirection =getComputedStyle(element).direction === "rtl" ? -1 : 1;+ // Reconcile after scrolling settles so intermediate positions cannot undo navigation.const updateIndex = () => {const newIndex = this.#calculateNearestIndex(element);if (newIndex !== this.currentIndex) {@@ -49,11 +49,6 @@ export default class ImageCarousel extends Component {let scrollStopTimer;const onScroll = () => {- // Optimistic update while scrolling for real-time dot feedback- if (!isTesting()) {- throttle(this, updateIndex, SCROLL_THROTTLE_MS);- }-// Fallback for browsers without scrollend support (Safari < 17.4)if (!supportsScrollEnd) {clearTimeout(scrollStopTimer);