From e263ebda99f3d414bae91a4a47e74a37ff93ba9c Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 27 Sep 2013 18:53:15 +0200 Subject: Dialog: Switch back to shuffling z-index, but only look at .ui-front siblings. Fixes #9166 - Dialog: moveToTop implementation resets flash/video/iframe/scroll Fixes #9364 - Dialog: Click of element with tooltip scrolls the dialog to the top --- ui/jquery.ui.dialog.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index f7265e605..0669cd852 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -212,7 +212,17 @@ $.widget( "ui.dialog", { }, _moveToTop: function( event, silent ) { - var moved = !!this.uiDialog.nextAll(":visible").insertBefore( this.uiDialog ).length; + var moved = false, + zIndicies = this.uiDialog.siblings( ".ui-front:visible" ).map(function() { + return +$( this ).css( "z-index" ); + }).get(), + zIndexMax = Math.max.apply( null, zIndicies ); + + if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { + this.uiDialog.css( "z-index", zIndexMax + 1 ); + moved = true; + } + if ( moved && !silent ) { this._trigger( "focus", event ); } -- cgit v1.2.3