Add onClick listener to dismiss toast notification.#7268
Add onClick listener to dismiss toast notification.#7268bramkragten merged 1 commit intohome-assistant:devfrom
Conversation
|
We should add a Dismiss button to all of them. Adding this will add two different ways of dismissing some of our toasts |
c87b629 to
001c225
Compare
|
@zsarnett Check if now makes sense, please. |
src/managers/notification-manager.ts
Outdated
| <mwc-button | ||
| .label=${this.hass.localize("ui.notification_toast.dismiss")} | ||
| @click=${this.dismiss} | ||
| ></mwc-button> |
There was a problem hiding this comment.
The dismissal action should be passed as an action from the caller. We should not just add a button on every toast.
There was a problem hiding this comment.
Ok, if I understand you, I added a default action to only dismiss toast, and now we will always have only one button. Take a look, please.
001c225 to
6efef8d
Compare
src/managers/notification-manager.ts
Outdated
| this._action = { | ||
| text: this.hass.localize("ui.notification_toast.dismiss"), | ||
| }; |
There was a problem hiding this comment.
This part should move to the caller of the toast, we should be able to decide per toast if it is dismissable. Like the connection lost toast should not be dismissable
There was a problem hiding this comment.
We should make it so that the dismiss is optional but on by default no?
I think a toast should usually be dismissable and should only not be dismissable in fewer cases.
Adding this as the default I think is good.
There was a problem hiding this comment.
They will be hidden after X time. But you have to wait form that. Also, just a caution guideline 😉
There was a problem hiding this comment.
Maybe the onClick was the best idea instead of a button action on each. In the Google Photos App. If I delete an image. I can click the toast to dismiss it. as well as there is an action to undo the action taken.
There was a problem hiding this comment.
@zsarnett @bramkragten So, should I revert to toast onClick or add a dismiss button on some toasts?
There was a problem hiding this comment.
Add a dismiss button for some toasts, like the HA is starting one. We should not allow dismissing them all.
There was a problem hiding this comment.
@bramkragten Ok, is there any more toasts besides that one to add a dismiss button?
There was a problem hiding this comment.
Not sure, you can search the code base for showToast
6efef8d to
67938e7
Compare

Proposed change
Dismiss toast notification on click to prevent blocking user accessing some menu buttons (like profile button).
Type of change
Example configuration
No configuration needed.
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: