Skip to content

Commit a7353e7

Browse files
committed
Dailog: Cover iframes during drag and resize. Fixes #7650 - Dialog cannot be dragged properly with IFRAME.
1 parent 8724092 commit a7353e7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

ui/jquery.ui.dialog.js

+26
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ $.widget( "ui.dialog", {
444444
containment: "document",
445445
start: function( event, ui ) {
446446
$( this ).addClass("ui-dialog-dragging");
447+
that._blockFrames();
447448
that._trigger( "dragStart", event, filteredUi( ui ) );
448449
},
449450
drag: function( event, ui ) {
@@ -455,6 +456,7 @@ $.widget( "ui.dialog", {
455456
ui.position.top - that.document.scrollTop()
456457
];
457458
$( this ).removeClass("ui-dialog-dragging");
459+
that._unblockFrames();
458460
that._trigger( "dragStop", event, filteredUi( ui ) );
459461
}
460462
});
@@ -491,6 +493,7 @@ $.widget( "ui.dialog", {
491493
handles: resizeHandles,
492494
start: function( event, ui ) {
493495
$( this ).addClass("ui-dialog-resizing");
496+
that._blockFrames();
494497
that._trigger( "resizeStart", event, filteredUi( ui ) );
495498
},
496499
resize: function( event, ui ) {
@@ -500,6 +503,7 @@ $.widget( "ui.dialog", {
500503
options.height = $( this ).height();
501504
options.width = $( this ).width();
502505
$( this ).removeClass("ui-dialog-resizing");
506+
that._unblockFrames();
503507
that._trigger( "resizeStop", event, filteredUi( ui ) );
504508
}
505509
})
@@ -666,6 +670,28 @@ $.widget( "ui.dialog", {
666670
}
667671
},
668672

673+
_blockFrames: function() {
674+
this.iframeBlocks = this.document.find( "iframe" ).map(function() {
675+
var iframe = $( this );
676+
677+
return $( "<div>" )
678+
.css({
679+
position: "absolute",
680+
width: iframe.outerWidth(),
681+
height: iframe.outerHeight()
682+
})
683+
.appendTo( iframe.parent() )
684+
.offset( iframe.offset() )[0];
685+
});
686+
},
687+
688+
_unblockFrames: function() {
689+
if ( this.iframeBlocks ) {
690+
this.iframeBlocks.remove();
691+
delete this.iframeBlocks;
692+
}
693+
},
694+
669695
_createOverlay: function() {
670696
if ( !this.options.modal ) {
671697
return;

0 commit comments

Comments
 (0)