Skip to content

session reorder marker bug #124

Closed
Closed

Description

@arnonuem

The insert marker which appears when session are reordered is drawn correctly when a session is moved upwards but it is misleading/wrong when a session is moved downwards. Why? Because it marks the same position (above the element). A simple fix could be to leave the marker as it is when a session is moved upwards but to put the marker to the bottom of a session when it is moved downwards. The gif animation shows both scenarios.

Image

The first run demonstrates the incorrect behavior then the session is moved to its original position and then it shows the correct behavior but with bad ux in the second half of the gif.

Activity

  1. amirlehmam commented on Jul 28, 2026

    @amirlehmam
    Owner

    Fixed in v0.38.0. Your diagnosis was exactly right, and the gif made it obvious — thanks for taking the time to record both halves.

    What was happening. The drop handler removed the dragged row and re-inserted it at the hovered row's index. Dragging up, that lands above the target. Dragging down, removing an earlier element shifts every later index by one, so the same code lands it below. The marker was drawn above the hovered row either way, so it described one direction correctly and the other not at all.

    On your suggested fix. Direction-dependent markers would have matched the behaviour, but you spotted the cost yourself in the second half of the gif: you have to aim one row past where you want the session to end up, and the marker's meaning changes depending on which way you came from. So I went one step further and removed direction from the equation entirely — the pointer's half of the row picks the edge:

    • pointer in the top half → marker on the top edge → lands before that session
    • pointer in the bottom half → marker on the bottom edge → lands after it

    Marker and landing spot now come from a single value, so they cannot disagree. Dropping onto an edge a session already sits on is a no-op rather than a pointless re-render, the marker is drawn inset so the bottom edge of the last row isn't clipped, and it clears when you drag out of the list instead of lingering on the last row you passed.

    Covered by tests including both directions × both edges, the list ends, no-ops, and a check that no reorder ever drops or duplicates a session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions