diff --git a/src/ContextMenu.ts b/src/ContextMenu.ts index 7ba8e675e..d1889fb34 100644 --- a/src/ContextMenu.ts +++ b/src/ContextMenu.ts @@ -139,7 +139,7 @@ export class ContextMenu { }) // insert before checking position - const ownerDocument = (options.event?.target as Node).ownerDocument + const ownerDocument = (options.event?.target as Node)?.ownerDocument const root_document = ownerDocument || document if (root_document.fullscreenElement)