Skip to content

Sort by date #560

Answered by clauderic
louptheron asked this question in Q&A
Jan 6, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

@dnd-kit is un-opinionated as to what should happen when you drop a draggable item on a droppable container.

It's entirely up to the consumer to decide what should happen in that scenario. The examples in the storybook assume that an element should be inserted below the item you are currently over, or at the end of the list if you are over a column.

For example, you could decide to always insert items at the top of a column when you move a ticket from one column to another (either in onDragOver or onDragEnd):

onDragEnd={({active, over}) => {
  const overId = over?.id;

  if (!overId || overId === TRASH_ID || active.id in items) {
    return;
  }

  const overContainer = findContainer(overId)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@louptheron
Comment options

Answer selected by clauderic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants