From f084273082d1a4c11383dfe5e056cac1dd10b8e0 Mon Sep 17 00:00:00 2001 From: Enrico Gruner Date: Tue, 5 Nov 2024 11:28:56 +0100 Subject: [PATCH] fix carousel item children with anchors --- src/components/carousel/carousel.component.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/carousel/carousel.component.ts b/src/components/carousel/carousel.component.ts index 8e87bad9c..e229a54fa 100644 --- a/src/components/carousel/carousel.component.ts +++ b/src/components/carousel/carousel.component.ts @@ -262,6 +262,9 @@ export default class SlCarousel extends ShoelaceElement { @eventOptions({ capture: true }) private handleClick(e: MouseEvent) { if (this.dragging) { + // prevents anchor tags within carousel items from triggering while dragging + e.preventDefault(); + // prevents click events within carousel items from triggerin while dragging e.stopPropagation(); } }