-
-
Notifications
You must be signed in to change notification settings - Fork 298
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
Console error with 'not-draggable' class #91
Comments
I've added the following verification in line 983: (!source || item.classList.contains('not-draggable')) { return } |
Hi @felipeEddy can you make a pull request? |
Hi, @felipeEddy you had worked on dist folder. Can you apply all your code to |
@riktar I noticed when I applied the class inside my kanban-item div it does not work. Is it possible to extend this feature to scan for underlaying not-draggable classes? |
I guess that might not be possible, while dragula event is attached to an entire item. |
@marcosrocha85 Do you think so? Is it not possible to check if there is a class when starting to drag? If so cancel the drag functionality. |
I don't know if I misread you, but the point of this issue were if item had a 'not-draggable' class so mouse down would not fire dragging. That's actually in production on jKanban. If an item had 'not-draggable' class drag should be cancelled. |
@marcosrocha85 Yes I understand, I saw the code in production. But this works only on the Because I have a dropdown inside |
I got it. I drag was being fired just on kanban-item, but it appears to being fired on element that fires the mouse down. I'll take a look at this just right now. |
I was able to reproduce the issue by adding a dropdown (select) inside an item. The problem is that the drag event is fired after mouse leaves the select element and besides that the event parameters doesn't give any clue that the event came from there. In fact, dragula (which handles the drag and drop from jKanban) is thinking everything started from kanban-item element. What I done in the past was using a plugin like https://github.com/sandywalker/webui-popover like Trello does (poping up a window or dialog in order to show possible options to act) |
I was thinking, what if you use the property "itemHandle"?
|
@marcosrocha85 I tried this but it doesn't have any effect. Do you know something else what I can try? |
@marcosrocha85 I've tried some code and the code below fixes the issue.
|
You can use jKanban dragEl or dropEl events. dragEl: function(el, source) {
if ($(el).hasClass('not-draggable')) {
jkanban.drake.cancel(true);
}
}, // AND/OR
dropEl: function(el, source, target, sibling) {
if ($(el).hasClass('not-draggable')) {
jkanban.drake.cancel(true);
}
} You can play with that and develop a solution that fits your needs. 🙃 |
First, i would like to thank you guys for the excellent work so far.
In my application i have a dropdown inside an item of the kanban. When the dropdown is show, i don't want the item to be draggable, so i'm adding the class 'not-draggable', which i have found in the plugin code. The problem is, when we try to drag an item an error in the console appears, although the item really do not drag.
My question is, i'm using the class in the wrong way or it is really an error in the plugin?
The error is below:
Uncaught TypeError: can't access property "getBoundingClientRect", el is null jkanban.js:1344:28
The text was updated successfully, but these errors were encountered: