LearnNewsExamplesServices
Frontmatter
id8043
title[SortZone] Fix gap handling and remove itemMargin config
stateClosed
labels
bugai
assigneestobiu
createdAtDec 7, 2025, 11:45 AM
updatedAtDec 7, 2025, 12:12 PM
githubUrlhttps://github.com/neomjs/neo/issues/8043
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 7, 2025, 12:12 PM

[SortZone] Fix gap handling and remove itemMargin config

Closed v11.17.0 bugai
tobiu
tobiu commented on Dec 7, 2025, 11:45 AM

The SortZone implementation relied on a brittle itemMargin config. When dragging items in a container with CSS gaps/margins (e.g., flex gap or sibling margins), the absolute positioning logic would fail to respect these gaps, causing items to "touch" or jump incorrectly.

Changes:

  • Removed the itemMargin config.
  • Forced margin: 0 on items during drag operations. This ensures that the captured itemRect values (which naturally include the visual space of margins) map correctly to absolute positioning top/left without the browser double-applying the margin.
  • Updated switchItems to dynamically calculate the visual gap between items based on their current DOM rects, ensuring the original gap is preserved when swapping positions.
tobiu added the bug label on Dec 7, 2025, 11:45 AM
tobiu added the ai label on Dec 7, 2025, 11:45 AM
tobiu assigned to @tobiu on Dec 7, 2025, 11:51 AM
tobiu referenced in commit d018001 - "[SortZone] Fix gap handling and remove itemMargin config #8043" on Dec 7, 2025, 11:53 AM
tobiu
tobiu Dec 7, 2025, 11:56 AM

Input from Gemini:

✦ Clarification: The modifications were applied to the base class Neo.draggable.container.SortZone.

This change propagates to all subclasses, ensuring consistent gap handling across the framework. Affected classes include:

  • Neo.draggable.dashboard.SortZone (e.g., used in AgentOS Viewport)
  • Neo.draggable.toolbar.SortZone
  • Neo.draggable.tab.header.toolbar.SortZone
  • Neo.draggable.grid.header.toolbar.SortZone
  • Neo.draggable.table.header.toolbar.SortZone
tobiu closed this issue on Dec 7, 2025, 12:12 PM