LearnNewsExamplesConnect
Frontmatter
assigneesneo-gemini-julia
createdAtNov 8, 2026, 8:57 PM
updatedAtNov 8, 2026, 10:06 PM
githubUrlhttps://github.com/neomjs/neo/issues/20605
authorneo-gemini-julia
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 8, 2026, 10:06 PM

SortZone hooks for pinning non-sortable siblings and scoping dragElement

Closed v13.4.0/archive-v13-4-0-chunk-5 enhancementaicoredrag-and-drop
neo-gemini-julia
neo-gemini-julia commented on Nov 8, 2026, 8:57 PM

Context

When a Neo.draggable.container.SortZone subclass excludes non-sortable sibling items through isDraggableItem(item) / getSortableItems(owner.items) inside a flex container (e.g., pinned or locked items interspersed with sortable items), SortZone#onDragStart only switches sortableItems to position: 'absolute' while leaving excluded sibling items in normal flex flow. As soon as the sortable siblings leave normal flow, any non-sortable sibling collapses toward the start of the container instead of holding its visual slot. In addition, onDragStart hardcodes dragElement: VDomUtil.find(owner.vdom, draggedItem.id).vdom with no hook for subclasses whose dragHandleSelector should also scope the drag proxy root node.

The Problem

Because SortZone#onDragStart (src/draggable/container/SortZone.mjs:881–1046) and SortZone#processDragEnd (src/draggable/container/SortZone.mjs:578–716) inline the pinned-item set (sortableItems) and the initial dragElement lookup without subclass hooks, any SortZone subclass that needs non-sortable sibling items to remain pinned at their measured DOM rects during an active drag (or needs the drag proxy to clone a descendant handle node rather than the whole item) is forced to re-implement onDragStart and processDragEnd.

The Architectural Reality

  • SortZone#getSortableItems(items=this.owner.items) (src/draggable/container/SortZone.mjs:350–354) filters owner.items via getDraggableItems(items) (isDraggableItem).
  • SortZone#onDragStart (src/draggable/container/SortZone.mjs:962–1036) measures owner.getDomRect([owner.id].concat(sortableItems.map(e => e.id))) and sets position: 'absolute' on sortableItems only, while SortZone#processDragEnd (src/draggable/container/SortZone.mjs:631–652) restores wrapperStyle on me.sortableItems only.
  • SortZone#onDragStart (src/draggable/container/SortZone.mjs:937) sets dragElement: VDomUtil.find(owner.vdom, draggedItem.id).vdom directly instead of delegating to a protected getDragElement(draggedItem, handleNode) hook with handleNode resolved to the matched handle VDOM node in owner.vdom.

The Fix

  1. Add a protected hook getPinnedItems(ownerItems=this.owner.items, sortableItems=this.sortableItems) on Neo.draggable.container.SortZone (defaulting to sortableItems so existing behavior is unchanged; subclasses with non-sortable siblings in the same flex flow can return ownerItems so all siblings are measured, pinned at their rects during the drag, and restored in processDragEnd). The returned set must contain every entry in sortableItems in owner.items order.
  2. Add a protected hook getDragElement(draggedItem, handleNode=null) on Neo.draggable.container.SortZone (defaulting to VDomUtil.find(this.owner.vdom, draggedItem.id).vdom, where handleNode is the matched drag handle VDOM node resolved from owner.vdom when dragHandleSelector is active).
  3. Update onDragStart and processDragEnd in src/draggable/container/SortZone.mjs to measure, pin, and restore the getPinnedItems(...) set while keeping sortableItems / itemRects as the active sort participants.

Contract Ledger

Target surface Authority Proposed behavior Fallback Docs Evidence
Neo.draggable.container.SortZone#getPinnedItems this ticket returns the item set measured, pinned (position: 'absolute'), and restored across onDragStart / processDragEnd; must contain every entry in sortableItems in owner.items order defaults to sortableItems JSDoc unit
Neo.draggable.container.SortZone#getDragElement this ticket returns the VDOM root cloned into the drag proxy for draggedItem, receiving (draggedItem, handleNode) where handleNode is the matched drag handle VDOM node resolved from owner.vdom when dragHandleSelector is active defaults to VDomUtil.find(this.owner.vdom, draggedItem.id).vdom JSDoc unit

Decision Record impact: none.

Acceptance Criteria

  • SortZone#getPinnedItems defaults to sortableItems (preserving all existing SortZone unit/component specs) and when overridden to return owner.items, pins and restores excluded non-sortable siblings alongside sortableItems in onDragStart / processDragEnd (unit).
  • SortZone#getDragElement(draggedItem, handleNode) defaults to the item root VDOM and allows a subclass to return the handle VDOM node for the drag proxy (unit).

Out of Scope

  • Changing SortZone#getSortableItems or switchItems semantics for default callers where getPinnedItems is not overridden.

Avoided Traps

  • Including non-sortable items inside sortableItems (which would allow switchItems to swap them); pinning and sorting are distinct responsibilities when a container holds fixed/locked items beside sortable ones.

Related

  • #12878 · #8020

unowned-rationale: parked for post-v13.4 / post-Dec-1 engine window so subclasses that pin non-sortable siblings can retire their onDragStart / processDragEnd overrides.

Live latest-open sweep: checked latest 20 open issues in neomjs/neo (#20600 down to #24) + closed search (SortZone getSortableItems) at 2026-11-08T19:55:58Z; no equivalent found. A2A in-flight claim sweep: checked latest 30 messages (status: 'all') at 2026-11-08T19:55:39Z; no competing claim on SortZone. MC sweep: neomjs/neo SortZone getSortableItems onDragStart processDragEnd non-sortable sibling collapse, 6 results, no prior decision found. Own-assignment sweep: 0 open in neomjs/neo, none overlapping.

Origin Session ID: 9034adfd-39a3-4177-ae95-e171581bda84

Retrieval Hint: "SortZone getPinnedItems getDragElement onDragStart processDragEnd non-sortable sibling flex collapse"

tobiu referenced in commit cdcacc9 - "feat(draggable): add SortZone getPinnedItems and getDragElement hooks (#20605) (#20611) on Nov 8, 2026, 10:06 PM
tobiu closed this issue on Nov 8, 2026, 10:06 PM