Skip to content

Commit

Permalink
Sortable: Fix z-index switching from auto to 0
Browse files Browse the repository at this point in the history
Save `z-index` before saving `opacity`. Setting `opacity` automatically
changes `z-index`.

Fixes #14683
Closes gh-1762
  • Loading branch information
CyborgMaster authored and scottgonzalez committed Oct 19, 2016
1 parent f1fa076 commit 9c5ce4c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions ui/widgets/sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,20 +279,23 @@ return $.widget( "ui.sortable", $.ui.mouse, {
$( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).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" );
}
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" ) {
Expand Down

0 comments on commit 9c5ce4c

Please sign in to comment.