LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-grace
createdAtNov 16, 2026, 2:37 AM
updatedAtNov 16, 2026, 8:48 AM
githubUrlhttps://github.com/neomjs/neo/issues/21078
authorneo-opus-grace
commentsCount0
parentIssue21061
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[ ] 21065 Web desktop: launcher icons reorder by drag and drop
closedAtNov 16, 2026, 8:48 AM

list.SortZone: reorder a list's records by drag and drop

Closed v14.0.0/archive-v14-0-0-chunk-3 enhancementaicoredrag-and-drop
neo-opus-grace
neo-opus-grace commented on Nov 16, 2026, 2:37 AM

Context

Leaf of #21061, and the engine seam #21065 names: "If sort-on-drop needs an engine seam (for example a working list.SortZone), it is filed as its own engine ticket". The web desktop's launcher is a store-bound list.Base whose icons sit in a wrapped CSS grid, and its users must be able to reorder them.

The Problem

No engine primitive sorts a store-bound list by drag.

  • Neo.draggable.list.SortZone (src/draggable/list/SortZone.mjs) is an empty subclass of list.DragZone, which drags an item with a proxy and animates it back.
  • Neo.draggable.container.SortZone sorts a container's components along one axis. It swaps indices over a layout snapshot it measures itself, so it neither writes store records nor follows a wrapped grid.

There is also a latent defect in list.DragZone: it adds the neo-draggable delegate cls to the item vdom on store load only. list.Base#createItems() rebuilds vdom.cn from scratch on every filter and sort, so after the first re-render no item matches the drag:start delegate and the list can no longer be dragged.

The Architectural Reality

  • The main thread already hit-tests. Neo.main.draggable.sensor.Pointer#triggerStream resolves document.elementFromPoint(), and Neo.main.addon.DragDrop#getEventData ships that path as targetPath, with each node's rect, on every drag:move when the zone sets alwaysFireDragMove. The drag proxy is pointer-events: none (resources/scss/src/draggable/DragProxyComponent.scss), so the hit test sees the item under it. The App Worker needs no rect snapshot, and any layout works: rows, columns or a wrapped grid.
  • Store#updateRows() writes a batch as one change. A sorter with reapplyOnRecordChange: true re-sorts once, and Neo.data.TreeStore sorts each parent's children in its Structural Layer. TreeStore#getChildren() returns a parent's children across filters and expansion.
  • list.Base#afterSetDraggable() creates the zone from dragZoneConfig, so {module: list.SortZone} swaps it in.
  • Design authority: n/a — new behavior. The neo-draggable loss carries its defect excuse: a unit arm re-renders a draggable list through a filter and reads the cls, red on dev.

The Fix

  • list.Base#createItem() renders neo-draggable on every non-header item of a draggable list, so the affordance survives re-renders.
  • list.SortZone (alwaysFireDragMove: true):
    • Slot. On drag:move it reads targetPath for the first item of its own list that is a sibling of the dragged record (same parentId). The leading or trailing half of that item's rect along sortDirection puts the dragged record before or after it. A header, another parent's item, a gap or the dragged item itself keeps the current slot. Leaving the list restores the start order.
    • Preview. It reorders the siblings' item nodes in the owner's vdom, and the dragged item stays in place as a placeholder (neo-sort-source). Nothing is written to the store during the drag.
    • Commit. moveRecord(record, target, before) is the one commit path, for the pointer and for the keyboard. It renumbers sortField from 0 over every structural sibling, so filtered-out siblings keep their relative place. It writes once through store.updateRows() and fires sort. The list re-renders from the store's sort.
    • Cancel. Escape (drag:cancel) or a release outside the list re-renders from the store and animates the proxy back.
  • SCSS for the placeholder (resources/scss/src/draggable/list/SortZone.scss).

Acceptance Criteria

  • A drop over a sibling's leading or trailing half moves the dragged record before or after it. Its sortField values change in one updateRows() batch, and the list renders the store's new order (unit).
  • A header, another parent's item, a gap or the dragged item itself never becomes the slot (unit).
  • No record changes during the drag; Escape or a release outside the list leaves the store's order as it was (unit).
  • Filtered-out siblings keep their relative order across a move (unit).
  • moveRecord() commits the same way without a pointer, and fires sort (unit).
  • A draggable list keeps neo-draggable on its items after a filter or sort re-render, red on dev (unit).
  • A real mouse reorders icons in the web desktop launcher (#21065's branch; browser witness).

Out of Scope

  • Moving a record to another parent, multi-record drags and auto-scrolling a long list.
  • Keyboard bindings: each app binds its own keys to moveRecord() (#21065 does).
  • Touch tuning (#21075).

Related

Live latest-open + closed sweep: checked latest 20 open (60 open, red band; the owning epic #21061 takes this as a leaf) + open and closed search (list SortZone drag sort, neo-draggable list, list SortZone, list DragZone neo-draggable; closed hits #20849, #17353, #18781, #1473 read, none governs a list sort) + A2A last 15 + Memory Core (list reorder by drag, list SortZone) + own open assignments at 2026-11-16T01:36Z; no equivalent or prior exclusion found.

Origin Session ID: 7ceb0de7-6fcc-4777-879b-3a305deac77f Retrieval Hint: "list SortZone drag sort records targetPath elementFromPoint updateRows sortField neo-draggable createItems"

tobiu referenced in commit 9604a04 - "feat(draggable): list.SortZone reorders a list's records by drag and drop (#21078) (#21081) on Nov 16, 2026, 8:48 AM
tobiu closed this issue on Nov 16, 2026, 8:48 AM