From a20f8116a5a1e285d79bd5edf40001003ca8f98e Mon Sep 17 00:00:00 2001 From: Jeremy Mickelson Date: Thu, 13 Oct 2016 11:48:19 -0600 Subject: [PATCH] Save the z-index before we save the opacity to make sure we get the right value --- ui/widgets/sortable.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ui/widgets/sortable.js b/ui/widgets/sortable.js index a953501512c..fcb33ace145 100644 --- a/ui/widgets/sortable.js +++ b/ui/widgets/sortable.js @@ -279,13 +279,9 @@ return $.widget( "ui.sortable", $.ui.mouse, { $( "" ).appendTo( body ); } - if ( o.opacity ) { // opacity option - if ( this.helper.css( "opacity" ) ) { - this._storedOpacity = this.helper.css( "opacity" ); - } - this.helper.css( "opacity", o.opacity ); - } - + // We need to make sure to grab the zIndex before setting the + // opacity, because setting the opacity to anything lower than 1 + // causes the zIndex to change from "auto" to 0. if ( o.zIndex ) { // zIndex option if ( this.helper.css( "zIndex" ) ) { this._storedZIndex = this.helper.css( "zIndex" ); @@ -293,6 +289,13 @@ return $.widget( "ui.sortable", $.ui.mouse, { this.helper.css( "zIndex", o.zIndex ); } + if ( o.opacity ) { // opacity option + if ( this.helper.css( "opacity" ) ) { + this._storedOpacity = this.helper.css( "opacity" ); + } + this.helper.css( "opacity", o.opacity ); + } + //Prepare scrolling if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && this.scrollParent[ 0 ].tagName !== "HTML" ) {