jquery / jquery/jquery-ui

[sortable] drag nested items with parent "locked"

Open
#1,996 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Behavior shared with 1.12 Comp: Sortable Feature
Dominant language
JavaScript
Stars
11.3k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

Is it possible to lock parent elements on the sortable component but leave the children to be sortable?

For instance: https://jsfiddle.net/5mvLfw74/

I would like to sort items 11 and 12 but looks like since the parent is on the cancel selector the whole "tree" is locked.

For what i see the issue might be coming from https://github.com/jquery/jquery-ui/blob/70dae67b73dfea9126f126f516fe8286f1e73417/ui/widgets/mouse.js#L98

Looks like the closest element that matches the cancel selector is the parent and then the mouse event is not triggered

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the nested sortable behavior from the linked JSFiddle, then inspect the sortable component and the referenced ui/widgets/mouse.js line 98 where the cancel selector is checked. The fix is done when a locked parent prevents its own dragging while nested children such as items 11 and 12 remain sortable.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.