Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ayushkamadji opened this issue Jun 21, 2024 · 0 comments

Comments

@ayushkamadji
Copy link

ayushkamadji commented Jun 21, 2024

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.

@ayushkamadji ayushkamadji changed the title Dragging outside the boundary causes error accessing method on a null object Dragging outside the boundary causes error accessing attribute on a null object Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant