From aa331386d0b8bd7234d68485c1ae0b8fc4a96269 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 19 Feb 2018 17:10:21 -0800 Subject: [PATCH] #3396 modal close --- RELEASE-NOTES.md | 5 +++-- src/definitions/modules/modal.js | 23 ++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 504fa8a13e..0677707067 100755 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -11,12 +11,13 @@ **Minor Enhancements** - **Theming** - Added global variables for reassigning `normal` and `bold` font weights for custom font stacks. **Thanks @jaridmargolin** #6167 - **Search** - Category results now has `exact` setting matching dropdown for `fullTextSearch` preventing fuzzy search - -**Other Enhancements** - **Search** - Category results will now responsively adjust `title` row if titles are long instead of forcing a title width - **Dimmer** - Dimmers now have centered content with a single wrapping `content` element. - **Popup** - Popup will now align the center of the arrow (not the edge of the popup) when it would be reasonable (up to 2x arrow's offset from edge). [See this explanation](http://oi66.tinypic.com/2zr2ckk.jpg) - **Popup** - Popup can now position elements correctly even when they have a different offset context than their activating element. Like in [this example](https://jsfiddle.net/g853mc03/) +- **Modal** - You can now modify `closable` setting after init **Thanks @mdehoog** #3396 + +**Tiny Enhancements** - **Popup** - `arrowBackground` now inherits from `background` #6059 **Thanks @devsli** - **Popup** - Adds new variable `headerFontWeight` diff --git a/src/definitions/modules/modal.js b/src/definitions/modules/modal.js index f2d547af9f..8d3d564a05 100755 --- a/src/definitions/modules/modal.js +++ b/src/definitions/modules/modal.js @@ -241,26 +241,23 @@ $.fn.modal = function(parameters) { module.hide(); }, click: function(event) { + if(!settings.closable) { + module.verbose('Dimmer clicked but closable setting is disabled'); + return; + } var $target = $(event.target), isInModal = ($target.closest(selector.modal).length > 0), isInDOM = $.contains(document.documentElement, event.target) ; - if(!isInModal && isInDOM) { - if(settings.closable) { - module.debug('Dimmer clicked, hiding all modals'); - if( module.is.active() ) { - module.remove.clickaway(); - if(settings.allowMultiple) { - module.hide(); - } - else { - module.hideAll(); - } - } + if(!isInModal && isInDOM && module.is.active()) { + module.debug('Dimmer clicked, hiding all modals'); + module.remove.clickaway(); + if(settings.allowMultiple) { + module.hide(); } else { - module.debug('Dimmer clicked, but closable is set to false'); + module.hideAll(); } } },