From 4e599a370ba95f31d8b27c12bed551ce5b68afaa Mon Sep 17 00:00:00 2001 From: Matt Walker Date: Mon, 13 Jan 2020 10:56:41 +0000 Subject: [PATCH] Use document.body to check if an event target is within the page Some events will originate outside the map viewport such as keyboard events which originate with the element specified by keyboardEventTarget which could be document.body --- src/ol/PluggableMap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index 1966a43035..75c1f4a7be 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -934,7 +934,7 @@ class PluggableMap extends BaseObject { } const target = /** @type {Node} */ (mapBrowserEvent.originalEvent.target); if (!mapBrowserEvent.dragging) { - if (this.overlayContainerStopEvent_.contains(target) || !this.viewport_.contains(target)) { + if (this.overlayContainerStopEvent_.contains(target) || !document.body.contains(target)) { // Abort if the event target is a child of the container that doesn't allow // event propagation or is no longer in the page. It's possible for the target to no longer // be in the page if it has been removed in an event listener, this might happen in a Control