Skip to content

Add close buttons to toasts#2023

Open
noxire-dev wants to merge 2 commits intopingdotgg:mainfrom
noxire-dev:feature/toast-dismiss-button
Open

Add close buttons to toasts#2023
noxire-dev wants to merge 2 commits intopingdotgg:mainfrom
noxire-dev:feature/toast-dismiss-button

Conversation

@noxire-dev
Copy link
Copy Markdown
Contributor

@noxire-dev noxire-dev commented Apr 14, 2026

Summary

  • Add a close (X) button to standard and anchored toasts for one-click dismissal
  • Improves accessibility for keyboard/mouse users who can't easily swipe-to-dismiss
  • Uses existing XIcon from lucide-react, styled consistently with CopyErrorButton
  • No changes to existing swipe or auto-dismiss behavior

Test plan

  • Trigger toasts of each type (info, success, warning, error, loading)
  • Verify the X button appears on the right side of each toast
  • Verify clicking X immediately dismisses the toast
  • Verify swipe-to-dismiss still works as before
  • Verify toasts with action buttons show both the action and X button
  • Verify anchored (non-tooltip) toasts also have the X button
  • Verify tooltip-style anchored toasts do NOT have the X button

Note

Low Risk
UI-only change confined to toast rendering and styling; minimal behavioral impact beyond enabling manual dismissal.

Overview
Adds an explicit X close button to both standard stacked toasts and non-tooltip anchored toasts, enabling one-click dismissal via toastManager.close(...) / anchoredToastManager.close(...).

Updates toast layout spacing (pr-8) to make room for the new top-right close affordance while keeping existing action buttons and auto/swipe dismissal behavior intact.

Reviewed by Cursor Bugbot for commit b54ce34. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add close buttons to toasts in the web UI

Adds a dismiss button (X icon) to each toast in both the Toasts and AnchoredToasts components in toast.tsx. Clicking the button calls toastManager.close or anchoredToastManager.close with the toast's ID. Right padding on Toast.Content is increased (pr-8) to prevent content from overlapping the button.

Macroscope summarized b54ce34.

- Add a dismiss control to standard toasts
- Add the same close affordance to anchored toasts
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2c98c828-b4d3-4c35-afa3-5a4a7024b445

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 14, 2026
macroscopeapp[bot]
macroscopeapp bot previously approved these changes Apr 14, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 14, 2026

Approvability

Verdict: Needs human review

This UI change adds dismiss buttons to toasts, but an unresolved review comment identifies a medium-severity bug where the close button doesn't properly hide during toast stack collapse/expand transitions, remaining visible and interactive when it shouldn't be.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge
Copy link
Copy Markdown
Member

screenshots plss

@noxire-dev
Copy link
Copy Markdown
Contributor Author

noxire-dev commented Apr 15, 2026

Screenshot 2026-04-15 180541 Screenshot 2026-04-15 180552 Screenshot 2026-04-15 180558 Screenshot 2026-04-15 180604 Screenshot 2026-04-15 180608 Screenshot 2026-04-15 180614 Screenshot 2026-04-15 180627

sorry for the missing screenshots

the last picture 3 toast at the same time so its not a dup screenshots it just looks like that

@kendalled
Copy link
Copy Markdown

i did a more focused version of this fix specifically for the 'slow requests' toast, see pr #2040

@kendalled
Copy link
Copy Markdown

Hey can you reference my closed pr #2040 for styling? I think this fits the design language of t3 code a lot better. It looks like your dismiss button is centered vertically which is weird. Below is the way it looks on my closed pr. just incorporate that styling.

image

@juliusmarminge @noxire-dev

@juliusmarminge
Copy link
Copy Markdown
Member

Hey can you reference my closed pr #2040 for styling? I think this fits the design language of t3 code a lot better. It looks like your dismiss button is centered vertically which is weird. Below is the way it looks on my closed pr. just incorporate that styling.

image @juliusmarminge @noxire-dev

yea top-right definitely looks better. should also make sure the "Copy Error" button aligns well

Move the close button from inline (vertically centered) to absolute
top-right positioning matching the t3 design language. Add pr-8 padding
to toast content to prevent text overlap with the dismiss button.

Addresses review feedback from juliusmarminge referencing pingdotgg#2040 styling.
@macroscopeapp macroscopeapp bot dismissed their stale review April 16, 2026 09:27

Dismissing prior approval to re-evaluate b54ce34

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Apr 16, 2026
@noxire-dev
Copy link
Copy Markdown
Contributor Author

Screenshot 2026-04-16 123142 Screenshot 2026-04-16 123148 Screenshot 2026-04-16 123152 Screenshot 2026-04-16 123157 Screenshot 2026-04-16 123201 Screenshot 2026-04-16 123206 thank you for the feedback, I tweak the styling is this verison better ? if so i can update the branch @juliusmarminge

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b54ce34. Configure here.

type="button"
>
<XIcon className="size-3" />
</button>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close button ignores collapsed toast opacity/pointer-events

Medium Severity

The close button is placed outside Toast.Content as a sibling inside Toast.Root. When toasts are stacked, hideCollapsedContent applies not-data-expanded:opacity-0 and not-data-expanded:pointer-events-none to Toast.Content to hide non-front toasts' content during the collapsed state. Because the close button is not inside Toast.Content, it doesn't receive these classes — it stays fully opaque and interactive while the rest of the toast content is hidden/fading. During expand/collapse transitions of the stack, close buttons on non-front toasts appear instantly while content fades in over 250ms, and remain visible and clickable while content fades out.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b54ce34. Configure here.

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants