aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.dialog.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/jquery.ui.dialog.js')
-rw-r--r--ui/jquery.ui.dialog.js59
1 files changed, 42 insertions, 17 deletions
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index ec4032ff3..85dbddda2 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -207,6 +207,7 @@ $.widget( "ui.dialog", {
},
open: function() {
+ var that = this;
if ( this._isOpen ) {
if ( this._moveToTop() ) {
this._focusTabbable();
@@ -214,19 +215,19 @@ $.widget( "ui.dialog", {
return;
}
+ this._isOpen = true;
this.opener = $( this.document[0].activeElement );
this._size();
this._position();
this._createOverlay();
this._moveToTop( null, true );
- this._show( this.uiDialog, this.options.show );
-
- this._focusTabbable();
+ this._show( this.uiDialog, this.options.show, function() {
+ that._focusTabbable();
+ that._trigger("focus");
+ });
- this._isOpen = true;
this._trigger("open");
- this._trigger("focus");
},
_focusTabbable: function() {
@@ -395,7 +396,7 @@ $.widget( "ui.dialog", {
this.uiDialogButtonPane.remove();
this.uiButtonSet.empty();
- if ( $.isEmptyObject( buttons ) ) {
+ if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
this.uiDialog.removeClass("ui-dialog-buttons");
return;
}
@@ -443,6 +444,7 @@ $.widget( "ui.dialog", {
containment: "document",
start: function( event, ui ) {
$( this ).addClass("ui-dialog-dragging");
+ that._blockFrames();
that._trigger( "dragStart", event, filteredUi( ui ) );
},
drag: function( event, ui ) {
@@ -454,6 +456,7 @@ $.widget( "ui.dialog", {
ui.position.top - that.document.scrollTop()
];
$( this ).removeClass("ui-dialog-dragging");
+ that._unblockFrames();
that._trigger( "dragStop", event, filteredUi( ui ) );
}
});
@@ -490,6 +493,7 @@ $.widget( "ui.dialog", {
handles: resizeHandles,
start: function( event, ui ) {
$( this ).addClass("ui-dialog-resizing");
+ that._blockFrames();
that._trigger( "resizeStart", event, filteredUi( ui ) );
},
resize: function( event, ui ) {
@@ -499,6 +503,7 @@ $.widget( "ui.dialog", {
options.height = $( this ).height();
options.width = $( this ).width();
$( this ).removeClass("ui-dialog-resizing");
+ that._unblockFrames();
that._trigger( "resizeStop", event, filteredUi( ui ) );
}
})
@@ -665,6 +670,28 @@ $.widget( "ui.dialog", {
}
},
+ _blockFrames: function() {
+ this.iframeBlocks = this.document.find( "iframe" ).map(function() {
+ var iframe = $( this );
+
+ return $( "<div>" )
+ .css({
+ position: "absolute",
+ width: iframe.outerWidth(),
+ height: iframe.outerHeight()
+ })
+ .appendTo( iframe.parent() )
+ .offset( iframe.offset() )[0];
+ });
+ },
+
+ _unblockFrames: function() {
+ if ( this.iframeBlocks ) {
+ this.iframeBlocks.remove();
+ delete this.iframeBlocks;
+ }
+ },
+
_createOverlay: function() {
if ( !this.options.modal ) {
return;
@@ -677,16 +704,14 @@ $.widget( "ui.dialog", {
this._delay(function() {
// Handle .dialog().dialog("close") (#4065)
if ( $.ui.dialog.overlayInstances ) {
- this._on( this.document, {
- focusin: function( event ) {
- 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();
- }
+ this.document.bind( "focusin.dialog", function( event ) {
+ 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();
}
});
}
@@ -711,7 +736,7 @@ $.widget( "ui.dialog", {
$.ui.dialog.overlayInstances--;
if ( !$.ui.dialog.overlayInstances ) {
- this._off( this.document, "focusin" );
+ this.document.unbind( "focusin.dialog" );
}
this.overlay.remove();
this.overlay = null;