Prevent notification closing if mouse over notification

This commit is contained in:
Ben
2024-05-29 17:15:12 +01:00
parent 340c30345c
commit 926fbea499
2 changed files with 9 additions and 2 deletions
File diff suppressed because one or more lines are too long
@@ -25,7 +25,14 @@ export default (Alpine) => {
notification.duration &&
notification.duration !== 'persistent'
) {
setTimeout(() => this.close(), notification.duration)
setTimeout(() => {
if (! this.$el.matches(':hover')) {
this.close()
return
}
this.$el.addEventListener('mouseleave', () => this.close())
}, notification.duration)
}
this.isShown = true