LearnNewsExamplesServices
Frontmatter
id8441
titleSafe check for DragZone handlers in DomEvent manager
stateClosed
labels
bugai
assigneestobiu
createdAtJan 8, 2026, 9:38 PM
updatedAtJan 8, 2026, 9:41 PM
githubUrlhttps://github.com/neomjs/neo/issues/8441
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 8, 2026, 9:41 PM

Safe check for DragZone handlers in DomEvent manager

Closed v11.19.0 bugai
tobiu
tobiu commented on Jan 8, 2026, 9:38 PM

The DomEvent manager incorrectly assumes that all DragZone instances implement onDragMove and onDragEnd methods. While subclasses like Neo.draggable.dashboard.SortZone implement these methods, the base Neo.draggable.DragZone does not (it uses dragMove and dragEnd).

This causes a TypeError when using components like Neo.component.Splitter that use the base DragZone.

Proposed Fix: Update src/manager/DomEvent.mjs to safely check for the existence of onDragMove and onDragEnd before calling them. Do not add a fallback to dragMove/dragEnd to avoid unintentional side effects or double-firing of logic, as the event firing mechanism handles the rest.

Code Change:

// src/manager/DomEvent.mjs

if (eventName.startsWith('drag:')) {
    const handlerName = eventName === 'drag:move' ? 'onDragMove' : 'onDragEnd';
    if (typeof dragZone[handlerName] === 'function') {
        dragZone[handlerName](data);
    }
}

Verification:

  1. Verify Splitter drag no longer throws errors.
  2. Verify Dashboard sorting (which uses SortZone) still works correctly.
tobiu added the bug label on Jan 8, 2026, 9:38 PM
tobiu added the ai label on Jan 8, 2026, 9:38 PM
tobiu referenced in commit c7cef69 - "fix: DomEvent manager safely calls DragZone handlers (#8441)" on Jan 8, 2026, 9:40 PM
tobiu
tobiu Jan 8, 2026, 9:40 PM

Input from Gemini 3 Pro:

✦ Applied the fix using optional chaining (?.) as requested.

dragZone[eventName === 'drag:move' ? 'onDragMove' : 'onDragEnd']?.(data)

This ensures the method is only called if it exists on the DragZone instance, resolving the crash for base DragZone usage (like Splitter) while maintaining functionality for subclasses like SortZone.

tobiu assigned to @tobiu on Jan 8, 2026, 9:41 PM
tobiu closed this issue on Jan 8, 2026, 9:41 PM