Skip to content

fix(toast): finish swipes when pointer capture is lost - #4142

Open
dvd233 wants to merge 1 commit into
radix-ui:mainfrom
dvd233:fix/toast-lost-pointer-capture-4141
Open

dvd233 wants to merge 1 commit into
radix-ui:mainfrom
dvd233:fix/toast-lost-pointer-capture-4141

Conversation

@dvd233

@dvd233 dvd233 commented Sep 13, 2026

Copy link
Copy Markdown

Description

Fixes #4141.

An active Toast swipe could stay in its partially moved state when pointer capture ended without pointerup, such as after the pointer was released outside the browser window.

Finalize the stored swipe delta from lostpointercapture using the existing threshold behavior: dispatch swipeEnd when the threshold was reached and swipeCancel otherwise. Treat pointercancel as cancellation, and clear the swipe refs before explicitly releasing pointer capture on the normal pointerup path so the resulting lostpointercapture event cannot finish the same swipe twice.

Tests

  • Added regression coverage for below-threshold and above-threshold capture loss, pointer cancellation, and duplicate-event prevention during normal capture release
  • Verified the new tests fail against the unchanged source and pass with this fix
  • pnpm test --run --reporter=dot --maxWorkers=4 (984 passed, 2 skipped, 5 todo)
  • pnpm lint
  • pnpm types:check
  • pnpm build:ci
  • pnpm exec oxfmt --check packages/react/toast/src/toast.tsx packages/react/toast/src/toast.test.tsx .changeset/toast-lost-pointer-capture.md
  • git diff --check

@changeset-bot

changeset-bot Bot commented Sep 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cb88de7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
radix-ui Patch
@radix-ui/react-toast Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toast remains partially swiped when pointer is released outside the browser window

1 participant