Merge pull request #12227 from MoonE/fix-ie11-event-handling

Fix event handling for map in shadow root
This commit is contained in:
MoonE
2021-04-17 20:38:15 +02:00
committed by GitHub

View File

@@ -987,6 +987,10 @@ class PluggableMap extends BaseObject {
eventType === EventType.WHEEL ||
eventType === EventType.KEYDOWN
) {
const doc = this.getOwnerDocument();
const rootNode = this.viewport_.getRootNode
? this.viewport_.getRootNode()
: doc;
const target = /** @type {Node} */ (originalEvent.target);
if (
// Abort if the target is a child of the container for elements whose events are not meant
@@ -996,7 +1000,7 @@ class PluggableMap extends BaseObject {
// 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 that recreates it's content based on
// user interaction either manually or via a render in something like https://reactjs.org/
!this.getOwnerDocument().contains(target)
!(rootNode === doc ? doc.documentElement : rootNode).contains(target)
) {
return;
}