emilkowalski / sonner

An opinionated toast component for React.

Home Page:https://sonner.emilkowal.ski

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request]: Close Toast on Click Anywhere on the Toast

kronos1345 opened this issue · comments

Hello,

I am currently using your toast component and I appreciate its functionality. However, I've encountered a usability issue that could enhance the user experience significantly.

Issue: Currently, the toast can only be dismissed by clicking a close button, typically located in a corner. This requires precise mouse movement and interaction, which can be inconvenient for users.

Feature Request: I propose an enhancement where clicking anywhere on the toast itself would dismiss it. This would provide a more intuitive and faster way for users to close the toast, especially when they are in a hurry or not focused on precision.

This feature would align with common user expectations and improve the overall usability of the toast component.

Regards

@kronos1345 The toast can be currently dismissed by swiping down as well. If you want to close on click, you can add an onClick event to the toast and dimiss them programatically.

@emilkowalski Don't you think this should be added to the toast as a configuration at least?

if you feel like it's not worth adding as a feature, would you mind mentioning how to dismiss the toast programmatically while being able to use the features such as toast types and rich colors and so on?

how do u add a onClick event to the toast? find no option to do this. Do we have to create a custom toast just to do this?