From 2a55af9e13f057a47717604cc5302897266ff207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Schr=C3=B6der?= Date: Fri, 29 Jan 2016 09:26:32 +0100 Subject: [PATCH] extend modal 'closable' option #262 to specify the exact closable behavior of a modal you can now set closable to ```click``` to allow closing nnly by clicking on the dimmer or you can set it to ```escapeKey``` to allow closing only by pressing the escape key. --- src/definitions/modules/modal.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/definitions/modules/modal.js b/src/definitions/modules/modal.js index 24178361e0..492f931b60 100644 --- a/src/definitions/modules/modal.js +++ b/src/definitions/modules/modal.js @@ -264,12 +264,12 @@ $.fn.modal = function(parameters) { escapeKey = 27 ; if(keyCode == escapeKey) { - if(settings.closable) { + if(settings.closable && settings.closable !== 'click') { module.debug('Escape key pressed hiding modal'); module.hide(); } else { - module.debug('Escape key pressed, but closable is set to false'); + module.debug('Escape key pressed, but closable is set to ' + settings.closable); } event.preventDefault(); } @@ -494,7 +494,7 @@ $.fn.modal = function(parameters) { $module.removeClass(className.active); }, clickaway: function() { - if(settings.closable) { + if(settings.closable && settings.closable !== 'escapeKey') { $dimmer .off('click' + elementNamespace) ; @@ -579,7 +579,7 @@ $.fn.modal = function(parameters) { } }, clickaway: function() { - if(settings.closable) { + if(settings.closable && settings.closable !== 'escapeKey') { $dimmer .on('click' + elementNamespace, module.event.click) ;