Frontmatter
| id | 8043 |
| title | [SortZone] Fix gap handling and remove itemMargin config |
| state | Closed |
| labels | bugai |
| assignees | tobiu |
| createdAt | Dec 7, 2025, 11:45 AM |
| updatedAt | Dec 7, 2025, 12:12 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8043 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Dec 7, 2025, 12:12 PM |
[SortZone] Fix gap handling and remove itemMargin config
tobiu assigned to @tobiu on Dec 7, 2025, 11:51 AM

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.SortZoneNeo.draggable.tab.header.toolbar.SortZoneNeo.draggable.grid.header.toolbar.SortZoneNeo.draggable.table.header.toolbar.SortZone
tobiu closed this issue on Dec 7, 2025, 12:12 PM
The
SortZoneimplementation relied on a brittleitemMarginconfig. 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:
itemMarginconfig.margin: 0on items during drag operations. This ensures that the captureditemRectvalues (which naturally include the visual space of margins) map correctly to absolute positioningtop/leftwithout the browser double-applying the margin.switchItemsto dynamically calculate the visual gap between items based on their current DOM rects, ensuring the original gap is preserved when swapping positions.