Problem/Motivation
Drag and drop table item in multi-levels hierarchy is broken. For example, in Menu manage page we cannot drag a `child menu item with child items` to parent level.
What we expected:
(D7 and before #2154475: Convert position selectors to be compatible with with jQuery native-API selector patch)
What we get in D8
(D8-GIT-HEAD)
Step to reproduce:
1. Go to /admin/structure/menu/manage/admin
2. Trying to drag a menu tree with 2 or 3 levels to parent ( moving to left and right ) (@see above GIF)
`:eq(0)` is not equivalent to `.eq(0)`
`:first` is not equivalent to `.first()`
https://jsfiddle.net/4tv4eh6h/
** Note that it can't drag and drop parent-child trees in some condition and the same errors occurred on D7. Please compare it with D7 when you review the patch.
Proposed resolution
This error introduced by #2154475: Convert position selectors to be compatible with with jQuery native-API selector. Here's fixing to make it work as before patch.
Remaining tasks
- Review patch
- Create a follow up issue: At some cases, it may trying to match `.first()` but misused `:first`
User interface changes
-
API changes
-
Comment | File | Size | Author |
---|---|---|---|
#6 | broken.gif | 38.22 KB | droplet |
#6 | work.gif | 26.8 KB | droplet |
#4 | 2015-05-18_12-20-49.png | 5.76 KB | droplet |
tabledrag.patch | 5.05 KB | droplet | |
Comments
Comment #1
droplet CreditAttribution: droplet commentedComment #2
droplet CreditAttribution: droplet commentedComment #3
aburrows CreditAttribution: aburrows as a volunteer commentedThis works as intended in the latest release of 8.x.
Comment #4
droplet CreditAttribution: droplet commentedI re-checked and it still doesn't work. Just moving one item not whole tree
Comment #5
droplet CreditAttribution: droplet commentedComment #6
droplet CreditAttribution: droplet commentedComment #7
droplet CreditAttribution: droplet commentedComment #8
droplet CreditAttribution: droplet commentedComment #9
droplet CreditAttribution: droplet commentedComment #10
droplet CreditAttribution: droplet commentedComment #11
nod_Sorry for the delay in reviewing that, wanted to take the time to see where selectors were wrong.
Patch works, and from the looks of it we'd want to use
:first-of-type
all over the place where we used.eq(0)
.Comment #12
alexpottThis issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed dcf9ab4 and pushed to 8.0.x. Thanks!
Thanks for providing https://jsfiddle.net/4tv4eh6h/ and the screencasts - makes the bug easy to see.
Comment #14
hchonovThis patch introduced a problem which was not there before it!
$form['table_a'] = ['#type' => 'table'];
$form['table_a']['row1'] = ...;
$form['table_a']['row1']['column_1'] = .....;
$form['table_a']['row1']['column_1']['table_b'] = ['#type' => 'table'];
Now all the rows of table_b will get a double tabledrag-handle, when makeDraggable is running.
First from the run for table_a and then from the run for table_b!
Until the patch was commited everything was functioning properpy for this kind of nested tables....
And at least this problem is in exchanging the row
with
Excuse me for reopening the issue, but this is where the problem got in core.
Comment #15
droplet CreditAttribution: droplet commentedcan you post a patch/module with full testing code ?
Comment #16
hchonovcreated a follow issue for this problem as requested by @alexpott : #2499605: tabledrag is adding tabledrag-handle twice for nested tables
Comment #17
hchonovChanging status back to fixed. Please see the new issue.
Comment #18
alexpott