Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#13662 closed bug (fixed)

Sortable: placeholder can be wrong height when sorting variable-height table rows

Reported by: kevincupp Owned by: Scott González
Priority: minor Milestone: 1.12.2
Component: ui.sortable Version: 1.11.4
Keywords: Cc:
Blocked by: Blocking:


In the latest jQuery UI (1.11.4), reproduced in latest Safari (8.0.7) and Firefox (39.0), if you have a table with rows of variable height, or the height is dependent on the contents of the row, the placeholder height doesn't match the height of the row being dragged. By default, for all other elements that don't have a height, Sortable will set the height of the placeholder to the height of the item being dragged, and this used to be the case for table rows up until about 1.10 because Sortable was altered to add empty <td> elements to its placeholder <tr> element, thus giving the row a default height no matter what, and the smallest height possible for a row with content.

But it doesn't just cause a design problem. If that was all, I could solve it by setting the height of the placeholder in the start hook or something. It's a bigger problem because the containment bounds are set based on the placeholder height, and if that height is incorrect or smaller than expected, you cannot drag the row as far down the table as you could otherwise.

Here is a jsfiddle, notice dragging the first row inserts a smaller placeholder:

I have a pull request I'm going to submit to GitHub for a potential fix, submitting this ticket as a prerequisite.

Change History (2)

comment:1 Changed 7 years ago by Scott González

Owner: set to Scott González
Resolution: fixed
Status: newclosed

In 87eab46a:

Sortable: Setting table row placeholder height to be same as sorted row

Fixes #13662
Closes gh-1578

comment:2 Changed 7 years ago by Scott González

Milestone: none1.12.2
Note: See TracTickets for help on using tickets.