Skip to content

[feature] Add option to enable sorting without changing DOM structure #2450

@People-Sea

Description

@People-Sea

Is your feature request related to a problem? Please describe.

Currently, sortable operations modify the DOM structure directly when elements are dragged and reordered. However, in some scenarios, it is necessary to keep the DOM hierarchy unchanged while still allowing the order of sortable items to be updated.

Solvable issues:

#546
#2089
#2448
#347
The solution in issue #347 is actually very close to my needs, but if there are multiple fixed elements, problems will occur. In addition, this approach is not robust, and the order of comment nodes will also be disrupted.

Describe the solution you'd like

I would like to request a feature that adds an option to allow sorting only among sortable elements without affecting the overall DOM structure. This option should enable drag-and-drop sorting, but only change the order of sortable items, not the DOM structure itself.

Describe alternatives you've considered

This is my current solution: https://jsbin.com/loqucesima/edit?html,js,console,output. It’s a rather naive approach, but the implementation is relatively robust and preserves the complete DOM structure. However, the drag-and-drop animation is lost during the process.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions