tapToDismiss ignored when onclick is set
See original GitHub issueHello,
I’m trying to display a toast with the property tapToDismiss set to false
toastr.info('title', 'message', {
tapToDismiss: false,
closeButton: true,
timeOut: 0,
extendedTimeOut: 0,
});
This works well but if I add a onclick handler, the toast closes when I click it.
toastr.info('title', 'message', {
tapToDismiss: false,
closeButton: true,
timeOut: 0,
extendedTimeOut: 0,
onclick: function(){
alert('click');
}
});
Currently, I’ve found a workaround by adding the click handler on the elem returned by the info method but I think there is a little bug here…
var toast = toastr.info('title', 'message', {
tapToDismiss: false,
closeButton: true,
timeOut: 0,
extendedTimeOut: 0,
});
toast.on('click', function(){
alert('click');
});
Thanks
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
My onclick event is being ignored - javascript - Stack Overflow
The code that I've tried is below. The only thing that doesn't work is the onclick event. <a onClick="ga('set', 'nonInteraction' ...
Read more >Browser default actions - The Modern JavaScript Tutorial
The value returned by an event handler is usually ignored. The only exception is return false from a handler assigned using on<event> ....
Read more >https://raw.githubusercontent.com/DefinitelyTyped/...
tapToDismiss ?: boolean; /** * CSS class the toast element will be given ... than having identical toasts stack, set the preventDuplicates property...
Read more >angular2-toaster - npm
By default, the tapToDismiss option is set to true, meaning that if a toast is clicked anywhere on the toast body, the toast...
Read more >toastr.show() Code Example - Code Grepper
tapToDismiss :true, ... set timeOut and extendedTimeOut to 0 to make it sticky ... composer install ignore · Ignore platform version laravel ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For the moment, I use the workaround shown in my third exemple. But i think this bug comes from line 297 in toastr.js
Just add a check of tapToDismiss property before calling hideToast and it will do the trick
I’m having this problem again, and i’ve checked toastr.js and somehow the change made here no longer exists:
If it is meant to be this way, then please guide me to a workaround to this behavior.