Skip to content

Commit

Permalink
Fixes event namespace issues with modal/dimmer #3200
Browse files Browse the repository at this point in the history
  • Loading branch information
jlukic committed May 1, 2016
1 parent bad25f1 commit 764e790
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Version 2.2.0 - XX XX, 2016

**Major Enhancements**
- **Popup** - Added new `tooltip` popup type that works **without javascript**. Tooltips can specify positioning and some variations using `data` attributes, and will handle positioning automatically with CSS only.
- **Webpack** - Modified all relative paths in project to prefix with `./` to make them webpack friendly (wont be misinterpreted as module)
- **Popup** - Added new setting `boundary` and `scrollContext. `boundary` lets you specify an element that the popup will try to position itself to be contained inside of. `scrollContext` lets you specify the element which when scrolled should hide the popup
- **Popup** - Added new settings `autoRemove`, which is enabled by default. This will add special event listeners to auto hide a popup if the triggering element is removed from the DOM. This is useful in controlled DOM environments like Meteor/Ember/React to ensure a popup auto-hides itself when a page navigation or other DOM change occurs that may not trigger `mouseout`.
Expand Down Expand Up @@ -62,6 +63,7 @@
- **Menu** - `stackable` menu with `left/right` `menu` or `item` would incorrectly be floated when stacked. #3604
- **Menu** - `@dividerSize` was not being used in `vertical menu` #3781
- **Modal** - RGB values set for dimmer `background-color` were not being correctly interpreted #3665 **Thanks @larsbo**
- **Modal/Dimmer** - Fixed issue with `destroy` not properly removing events from dimmer #3200
- **Popup** - checking `instanceof SVGGraphicsElement` caused error in IE11 #3043
- **Progress** - Progress `onSuccess`, `onError`, and `onWarning` callbacks now occur **after** the animation completes for the state change.
- **Rating** - rating does not fire `onRate` when rating is initialized #3712
Expand Down
4 changes: 4 additions & 0 deletions src/definitions/modules/dimmer.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ $.fn.dimmer = function(parameters) {
$module
.removeData(moduleNamespace)
;
$dimmable
.off(eventNamespace)
;
}
},

Expand Down Expand Up @@ -206,6 +209,7 @@ $.fn.dimmer = function(parameters) {
? callback
: function(){}
;
debugger;
if( module.is.dimmed() || module.is.animating() ) {
module.debug('Hiding dimmer', $dimmer);
module.animate.hide(callback);
Expand Down
13 changes: 7 additions & 6 deletions src/definitions/modules/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ $.fn.modal = function(parameters) {
element = this,
instance = $module.data(moduleNamespace),

elementNamespace,
elementEventNamespace,
id,
observer,
module
Expand Down Expand Up @@ -141,7 +141,7 @@ $.fn.modal = function(parameters) {
},
id: function() {
id = (Math.random().toString(16) + '000000000').substr(2,8);
elementNamespace = '.' + id;
elementEventNamespace = '.' + id;
module.verbose('Creating unique id for element', id);
}
},
Expand All @@ -152,7 +152,8 @@ $.fn.modal = function(parameters) {
.removeData(moduleNamespace)
.off(eventNamespace)
;
$window.off(elementNamespace);
$window.off(elementEventNamespace);
$dimmer.off(elementEventNamespace);
$close.off(eventNamespace);
$context.dimmer('destroy');
},
Expand Down Expand Up @@ -213,7 +214,7 @@ $.fn.modal = function(parameters) {
.on('click' + eventNamespace, selector.deny, module.event.deny)
;
$window
.on('resize' + elementNamespace, module.event.resize)
.on('resize' + elementEventNamespace, module.event.resize)
;
}
},
Expand Down Expand Up @@ -503,7 +504,7 @@ $.fn.modal = function(parameters) {
clickaway: function() {
if(settings.closable) {
$dimmer
.off('click' + elementNamespace)
.off('click' + elementEventNamespace)
;
}
},
Expand Down Expand Up @@ -588,7 +589,7 @@ $.fn.modal = function(parameters) {
clickaway: function() {
if(settings.closable) {
$dimmer
.on('click' + elementNamespace, module.event.click)
.on('click' + elementEventNamespace, module.event.click)
;
}
},
Expand Down

0 comments on commit 764e790

Please sign in to comment.