diff options
author | Felix Nagel <info@felixnagel.com> | 2013-01-30 18:10:39 +0100 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2013-01-30 18:10:39 +0100 |
commit | 91dde04dadcd9b314e099ced040a763aa35b7b5c (patch) | |
tree | 3572e1b71f5c8998c46e411b9d992795a1105530 /ui/jquery.ui.dialog.js | |
parent | de149c47d79bf5822baad786591eb837fe2af769 (diff) | |
parent | ceebe07e2c99190030c16b031813ae660d9283d1 (diff) | |
download | jquery-ui-91dde04dadcd9b314e099ced040a763aa35b7b5c.tar.gz jquery-ui-91dde04dadcd9b314e099ced040a763aa35b7b5c.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui/jquery.ui.dialog.js')
-rw-r--r-- | ui/jquery.ui.dialog.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index ef5787ef6..ec4032ff3 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -679,7 +679,10 @@ $.widget( "ui.dialog", { if ( $.ui.dialog.overlayInstances ) { this._on( this.document, { focusin: function( event ) { - if ( !$( event.target ).closest(".ui-dialog").length ) { + if ( !$( event.target ).closest(".ui-dialog").length && + // TODO: Remove hack when datepicker implements + // the .ui-front logic (#8989) + !$( event.target ).closest(".ui-datepicker").length ) { event.preventDefault(); $(".ui-dialog:visible:last .ui-dialog-content") .data("ui-dialog")._focusTabbable(); @@ -692,7 +695,7 @@ $.widget( "ui.dialog", { this.overlay = $("<div>") .addClass("ui-widget-overlay ui-front") - .appendTo( this.document[0].body ); + .appendTo( this._appendTo() ); this._on( this.overlay, { mousedown: "_keepFocus" }); @@ -704,11 +707,15 @@ $.widget( "ui.dialog", { return; } - $.ui.dialog.overlayInstances--; - if ( !$.ui.dialog.overlayInstances ) { - this._off( this.document, "focusin" ); + if ( this.overlay ) { + $.ui.dialog.overlayInstances--; + + if ( !$.ui.dialog.overlayInstances ) { + this._off( this.document, "focusin" ); + } + this.overlay.remove(); + this.overlay = null; } - this.overlay.remove(); } }); |