Search and Top Navigation
#14889 new bug ()
Opened December 12, 2015 10:04PM UTC
Last modified July 26, 2016 03:42PM UTC
Sortable: Wrong placeholder height with tbody items and multiple <tr>s
| Reported by: | lxg | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | none | 
| Component: | ui.sortable | Version: | 1.11.4 | 
| Keywords: | Cc: | ||
| Blocked by: | Blocking: | 
Description
There’s the following issue with the ''Sortable'' widget:
When making a <table> with several <tbody>s which again contain several <tr>s sortable, the placeholder for the <tbody>s is too low.  This causes the height of the whole <table> (and the rest of the page below the table) to “flicker” as soon as a <tbody> is being dragged.
Example: http://jsfiddle.net/jzwq5j73/4/
The first part of this problem is that the placeholder for the <tbody> is created with only one <tr> with a series of empty <td>s. This is bad because (a) there may be more than one row, and (b) if the <td>s of the original <tbody> have content, they are likely to be higher than the empty ones in the placeholder.
Source reference: https://github.com/jquery/jquery-ui/blob/1.11.4/ui/sortable.js#L791-L795
The second part is the fact that the placeholder <tbody> doesn’t get the height of the original element, because it already has got a height (even though it’s a wrong one).
Source reference: https://github.com/jquery/jquery-ui/blob/1.11.4/ui/sortable.js#L817
Tested with jQuery UI 1.11.4, but saw this code in the master branch, too.
Attachments (0)
Change History (3)
Changed December 12, 2015 10:16PM UTC by comment:1
| _comment0: | Btw, 1.11.3 works just fine. → 1449958712335147 | 
|---|---|
| _comment1: | → 1449958747997734 | 
| _comment2: | (nevermind) → 1449958763858026 | 
| _comment3: | (deleted) → 1449958807623086 | 
| _comment4: | (comment deleted) → 1449959101264307 | 
| _comment5: | A “monkey-patch” workaround which works for me is to always assign the original element’s height to the placeholder in https://github.com/jquery/jquery-ui/blob/1.11.4/ui/sortable.js#L817 → 1449959142681991 | 
Changed February 18, 2016 12:00PM UTC by comment:2
So, does anybody care?
Changed July 26, 2016 03:42PM UTC by comment:3
| component: | ui.core → ui.sortable | 
|---|
A “monkey-patch” workaround which works for me is to always assign the original element’s height to the placeholder in https://github.com/jquery/jquery-ui/blob/1.11.4/ui/sortable.js#L817 (i.e. remove the
ifcondition and always execute the block).