diff --git a/.changeset/spotty-pears-agree.md b/.changeset/spotty-pears-agree.md new file mode 100644 index 0000000..b754485 --- /dev/null +++ b/.changeset/spotty-pears-agree.md @@ -0,0 +1,5 @@ +--- +"react-movable": patch +--- + +add check for element presence in "checkIfInteractive" utility diff --git a/src/utils.ts b/src/utils.ts index 89046f7..5a0d118 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -120,6 +120,8 @@ export function checkIfInteractive(target: Element, rootElement: Element) { "switch", "tab", ]; + if (!target || !rootElement) return false; + while (target !== rootElement) { if (target.getAttribute("data-movable-handle")) { return false;