Sortable icon indicating copy to clipboard operation
Sortable copied to clipboard

Add optional chaining operators to _checkOutsideTargetEl

Open zbigniewkuminski opened this issue 3 years ago • 4 comments

Hi. I used the library in a slightly different way than was foreseen. Overview: I have a structure of dynamic lists where elements can be moved between. In some scenarios. when I start to drag elements from one list to another, the source column dissappear. Here is my problem.

Issue: I am not sure, but I think Sortable.js don't handle scenario when source list is gone from the DOM. When it happens the _checkOutsideTargetEl function fails.

Solution: IMHO adding few "?" (as below) would fix the issue and shouldn't impact on other aspects of functionality

let _checkOutsideTargetEl = function(evt) {
	if (dragEl) {
		dragEl?.parentNode?.[expando]._isOutsideThisEl(evt.target);
	}
};

zbigniewkuminski avatar Jan 11 '23 13:01 zbigniewkuminski

+1

kamikaze942 avatar Feb 02 '23 08:02 kamikaze942

+1

DariuszLewandowski avatar Feb 02 '23 08:02 DariuszLewandowski

+1

ste-el-bow avatar Feb 03 '23 09:02 ste-el-bow

+1

WillianLiusHao avatar Jun 13 '23 03:06 WillianLiusHao