Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #54 from pgherveou/patch-3

handle confirmation closed through overlay click + unbind keydown
  • Loading branch information...
commit d75189a03430a31daea19d836ea1116b7ed2c43a 2 parents f9903c8 + 3d882ef
@tj authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  lib/components/dialog/dialog.js
View
2  lib/components/dialog/dialog.js
@@ -148,6 +148,7 @@ Dialog.prototype.overlay = function(){
.overlay({ closable: true })
.on('hide', function(){
self.closedOverlay = true;
+ self.emit('close');
self.hide();
});
return this;
@@ -248,5 +249,6 @@ Dialog.prototype.hide = function(ms){
Dialog.prototype.remove = function(){
this.emit('hide');
this.el.remove();
+ $(document).unbind('keydown.dialog');
return this;
};

2 comments on commit d75189a

@pgherveou

Just realised that there are scenario where the callback will be called twice
Sorry for the noise this will need one more pull request

if you click on the close button or the cancel button, callback is fired twice
so overlay should emit and overlayclose instead of close and we should catch this event as well to call the callback
This solution is ok for you ?

@tj
Owner

overlay only has "show" and "hide" which is fine for that component, but in here yeah we can special-case if we need to

Please sign in to comment.
Something went wrong with that request. Please try again.