Skip to content

[bug] Multidrag -- Incorrect indicies being returned onSelect / onDeselect #2021

@kevannguyen

Description

@kevannguyen

When multidragging items, the sortable event that's passed onSelect and onDeselect will sometimes return a list of incorrect selected indexes. An erroneous list of selected indexes will generally consist of a list of "-1" values, e.g. [-1, -1, -1, -1].

To Reproduce
Steps to reproduce the behavior:

  1. Go to code sandbox -- may have to refresh the sandbox browser on load for code to run.
  2. Select 3+ items and then multidrag anywhere in the list. Repeat this step until it displays an erroneous list of indexes in the browser e.g. [-1, -1, -1, -1]

Expected behavior
Expect the returned indexes to be correct and not full of -1 values as indexes.

Information

Versions - Look in your package.json for this information:
sortablejs = ^1.11.2-alpha.4
@types/sortablejs = ^1.10.6 // Using javascript for sandbox demonstration. But personal project uses typescript.

Reproduction
codesandbox: https://codesandbox.io/s/sortablejs--multidrag-incorrect-indexing-dnrni?file=/src/index.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    MultiDragRelating to the MultiDrag pluginbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions