sonner icon indicating copy to clipboard operation
sonner copied to clipboard

Partially revert issue #224: restore hover-to-show close button behavior on desktop devices

Open dpkass opened this issue 2 months ago • 0 comments

I’d like to propose partially reverting issue #224.

The previous behavior should be restored for desktop devices. On mobile it makes sense to keep the button always visible for accessibility and touch targets.

On desktop platforms, especially macOS, this is actually the expected interaction pattern (mirroring the native notification bar behavior), so users are familiar with it.

A reasonable approach would be:

@media (hover: hover) {
  [data-sonner-toast] [data-close-button] {
    opacity: 0;
    visibility: hidden;
  }
  [data-sonner-toast]:hover [data-close-button],
  [data-sonner-toast]:focus-within [data-close-button] {
    opacity: 1;
    visibility: visible;
  }
}

This would reintroduce hover-to-show behavior only for pointer/hover-capable devices, leaving mobile UX unchanged.

dpkass avatar Oct 26 '25 23:10 dpkass