From d9695cc056b81a04dc79f2e59fd9cf8a2990dbfc Mon Sep 17 00:00:00 2001 From: James Lucas Date: Mon, 1 Jul 2024 12:30:17 +1000 Subject: [PATCH] fix: add in check for .length to ensure we are within the stage-wrap --- src/js/form-builder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/form-builder.js b/src/js/form-builder.js index b44a5c0b1..6235bb1b8 100644 --- a/src/js/form-builder.js +++ b/src/js/form-builder.js @@ -155,7 +155,7 @@ function FormBuilder(opts, element, $) { return false } - if ($(ui.item).closest('.stage-wrap') && $(ui.item).closest(rowWrapperClassSelector).length === 0) { + if ($(ui.item).closest('.stage-wrap').length && $(ui.item).closest(rowWrapperClassSelector).length === 0) { h.doCancel = true processControl(ui.item) } else {