Skip to content

Commit 0d7ece8

Browse files
authored
fix(code): make toast close button clickable (#2145)
## 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.
1 parent 57a6677 commit 0d7ece8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

apps/code/src/renderer/utils/toast.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function ToastComponent(props: ToastProps) {
6161
color="gray"
6262
onClick={() => sonnerToast.dismiss(id)}
6363
>
64-
<XIcon size={12} />
64+
<XIcon size={12} className="pointer-events-none" />
6565
</IconButton>
6666
)}
6767
</Flex>

0 commit comments

Comments
 (0)