diff --git a/packages/core/src/canvas/index.ts b/packages/core/src/canvas/index.ts index 88940b85b..3e4aca716 100644 --- a/packages/core/src/canvas/index.ts +++ b/packages/core/src/canvas/index.ts @@ -486,7 +486,9 @@ export default class CanvasModule extends Module { */ getMouseRelativePos(e: any, opts: any = {}) { const subWinOffset = opts.subWinOffset; - const doc = e.target.ownerDocument; + const { target } = e; + // In Firefox, pointing outside the window, will return the HTMLDocument. + const doc = target.nodeType === Node.DOCUMENT_NODE ? target : target.ownerDocument; const win = doc.defaultView || doc.parentWindow; const frame = win.frameElement; const yOffset = subWinOffset ? win.pageYOffset : 0;