Skip to content

fix(code): make toast close button clickable#2145

Merged
adboio merged 1 commit into
mainfrom
posthog-code/fix-toast-close-button
May 14, 2026
Merged

fix(code): make toast close button clickable#2145
adboio merged 1 commit into
mainfrom
posthog-code/fix-toast-close-button

Conversation

@MarconLP
Copy link
Copy Markdown
Member

Summary

  • The X (close) button on toasts was unresponsive — clicking it did nothing.
  • Root cause: sonner's pointerdown handler on the toast <li> only short-circuits when event.target.tagName === 'BUTTON'. Clicking the X made the SVG icon the event target, so sonner called setPointerCapture on the SVG and engaged its swipe logic, swallowing the click before the IconButton's onClick could fire sonnerToast.dismiss(id).
  • Fix: add pointer-events-none to the <XIcon> so the click target is always the button itself, which hits sonner's BUTTON early-return.
  • Applies to every toast type (success / error / info / warning), not just "You're on the latest version" — that one was just easy to reproduce because it's a sticky non-loading toast.

Test plan

  • Trigger "You're on the latest version" toast (Check for updates → already up to date) and click the X — toast dismisses.
  • Trigger any error/success/info/warning toast and click the X — toast dismisses.
  • Toasts with an action label still dismiss when the action is clicked.

The X button on toasts swallowed clicks because sonner's pointerdown
handler only short-circuits when event.target is a BUTTON; clicking the
SVG icon made it the target, sonner engaged swipe handling, and the
button's onClick never fired. Disable pointer events on the icon so the
button itself is always the target.

Generated-By: PostHog Code
Task-Id: 50570d7f-97f6-4f2a-b88e-45fb836a1061
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 13, 2026

Reviews (1): Last reviewed commit: "fix(code): make toast close button click..." | Re-trigger Greptile

@adboio adboio added the Create Release This will trigger a new release label May 14, 2026 — with Graphite App
@adboio adboio merged commit 0d7ece8 into main May 14, 2026
15 checks passed
Copy link
Copy Markdown
Contributor

adboio commented May 14, 2026

Merge activity

@adboio adboio deleted the posthog-code/fix-toast-close-button branch May 14, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Create Release This will trigger a new release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants