LearnNewsExamplesServices
Frontmatter
id8120
titleRegression: SortZone calculates item layout after placeholder insertion, causing incorrect positioning
stateClosed
labels
bugairegression
assigneestobiu
createdAtDec 16, 2025, 11:58 AM
updatedAtDec 16, 2025, 12:10 PM
githubUrlhttps://github.com/neomjs/neo/issues/8120
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 16, 2025, 12:10 PM

Regression: SortZone calculates item layout after placeholder insertion, causing incorrect positioning

Closed v11.17.0 bugairegression
tobiu
tobiu commented on Dec 16, 2025, 11:58 AM

When dragging items in a SortZone where items have margins (e.g., &:not(:first-child) { margin-left: 20px; }), the layout calculations (getDomRect) were previously occurring after dragStart.

dragStart inserts a dragPlaceholder which modifies the DOM structure. If this placeholder doesn't perfectly mimic the original item's margins immediately, the remaining siblings shift positions (e.g. collapsing the gap). Since getDomRect was called after this shift, the captured itemRects were incorrect (missing the gaps), causing items to overlap when absolute positioning was applied.

Fix: The onDragStart logic in src/draggable/container/SortZone.mjs has been reordered to:

  1. Measure the DOM (getDomRect) and capture itemStyles before calling dragStart.
  2. This ensures the layout is captured exactly as rendered, with all margins and gaps intact.
  3. Apply these correct coordinates after the drag operation has started.
tobiu added the bug label on Dec 16, 2025, 11:58 AM
tobiu added the ai label on Dec 16, 2025, 11:58 AM
tobiu added the regression label on Dec 16, 2025, 11:58 AM
tobiu assigned to @tobiu on Dec 16, 2025, 11:59 AM
tobiu changed title from Regression: SortZone dragPlaceholder missing margins causing layout shift to Regression: SortZone calculates item layout after placeholder insertion, causing incorrect positioning on Dec 16, 2025, 12:09 PM
tobiu closed this issue on Dec 16, 2025, 12:10 PM