Skip to content

Commit 5c02143

Browse files
authored
feat(toast): allow clickable items without closing
Some content inside toasts should remain clickable without closing the toast. (even if closeOnClick is true) While this was already hardcoded for a tags if fails for possible other tags like accordion or details (Especially when used together with the new #2197 😉 ) The previously hardcoded selector is not a customizable classname setting. Btw: input is not needed to be set here, because any kind of input inside a toast will already set the whole toast to not closing when clicked (because it is expected to be clicked into the input fields). The new setting here is supposed for elements which can be clicked, but are not expected to.
1 parent adc8d1a commit 5c02143

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/definitions/modules/toast.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ $.fn.toast = function(parameters) {
511511
module.close();
512512
},
513513
click: function(event) {
514-
if($(event.target).closest('a').length === 0) {
514+
if($(event.target).closest(selector.clickable).length === 0) {
515515
if(settings.onClick.call($toastBox, element) === false || !settings.closeOnClick) {
516516
module.verbose('Click callback returned false or close denied by setting cancelling close');
517517
return;
@@ -876,6 +876,7 @@ $.fn.toast.settings = {
876876
image : '> img.image, > .image > img',
877877
icon : '> i.icon',
878878
input : 'input:not([type="hidden"]), textarea, select, button, .ui.button, ui.dropdown',
879+
clickable : 'a, details, .ui.accordion',
879880
approve : '.actions .positive, .actions .approve, .actions .ok',
880881
deny : '.actions .negative, .actions .deny, .actions .cancel'
881882
},

0 commit comments

Comments
 (0)