Skip to content

Dragging outside the boundary causes error accessing attribute on a null object #709

Description

@ayushkamadji

With a drag zone that overflows the browser window, when dragging an item outside the browser window, errors will appear on the console because using doc.elementFromPoint returns null. MDN doc of elementFromPoint

dragula/dist/dragula.js

Lines 170 to 177 in 09ab978

if (o.ignoreInputTextSelection) {
var clientX = getCoord('clientX', e) || 0;
var clientY = getCoord('clientY', e) || 0;
var elementBehindCursor = doc.elementFromPoint(clientX, clientY);
if (isInput(elementBehindCursor)) {
return;
}
}

and this line tries to access tagName attribute on that null object.

function isInput (el) { return el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.tagName === 'SELECT' || isEditable(el); }

Screen.Recording.2024-06-21.at.13.53.22.mov

===
Dragula version: 3.7.3

Please only use GitHub issues for bug reports and feature requests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions