Skip to content

feat: add drag-and-drop event support (lvt-on:drag*) #101

@adnaan

Description

@adnaan

Context

Identified during the patterns example proposal — see livetemplate/docs/proposals/patterns.md (Future Features section) and the Sortable / Drag-and-Drop entry.

The Sortable pattern (#32 in the patterns proposal) is skipped until drag-and-drop event support lands. Without native lvt-on:drag* bindings, implementing reorder requires custom JavaScript, which violates the "no custom JavaScript" principle for examples.

Requirements

Client:

  • Add lvt-on:dragstart, lvt-on:dragover, lvt-on:drop event support (mirroring existing lvt-on:click etc.)
  • Serialize drag source / target data in the outgoing action message — the controller needs to know which item moved, where from, where to

Core (livetemplate library):

  • Reorder protocol for range items — extend existing range operations (["o", ["id1", "id2", …]] already exists for reorder; the new event surface needs to flow into it without bespoke patching)

Out of scope

  • Touch drag (HTML5 drag-and-drop API only for v1)
  • Custom drag previews / drag images
  • Drop zones across iframes

References

A complementary library issue can be filed if the protocol changes are non-trivial; the client side is the primary surface area.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions