Skip to content

An opinionated toast component for React.

fix: swallowed mouseUp event (#550)

Emil Kowalski8665072d342b
diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml
index 099bffc..75172c7 100644
--- a/.github/workflows/playwright.yml
+++ b/.github/workflows/playwright.yml
@@ -18,7 +18,7 @@ jobs:
- run: pnpm build
- run: npx playwright install --with-deps
- run: pnpm test || exit 1
- - uses: actions/upload-artifact@v3
+ - uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
diff --git a/src/index.tsx b/src/index.tsx
index 4e8c6e5..286996e 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -309,6 +309,11 @@ const Toast = (props: ToastProps) => {
...toast.style,
} as React.CSSProperties
}
+ onDragEnd={() => {
+ setSwiping(false);
+ setSwipeDirection(null);
+ pointerStartRef.current = null;
+ }}
onPointerDown={(event) => {
if (disabled || !dismissible) return;
dragStartTime.current = new Date();
@@ -821,6 +826,7 @@ const Toaster = forwardRef<HTMLElement, ToasterProps>(function Toaster(props, re
setExpanded(false);
}
}}
+ onDragEnd={() => setExpanded(false)}
onPointerDown={(event) => {
const isNotDismissible =
event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';