From 09ea59240a437e1d9199b3e93fe65322ac743cae Mon Sep 17 00:00:00 2001 From: Rob Hoelz Date: Sun, 25 Nov 2018 04:42:21 -0600 Subject: [PATCH] Cancel non-ancestor popups when showing a new popup (#3490) Addresses GH #3484 As far as I can tell, the popup level checks in this module are meant to handle nested popups. It seems to me that the goal is for at most a single hierarchy of popups to exist at any given time - bearing that in mind, this change checks any popups currently tracked by the module, canceling any that don't share an element hierarchy with the new popup. --- core/modules/utils/dom/popup.js | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/core/modules/utils/dom/popup.js b/core/modules/utils/dom/popup.js index e5fec19a9..4454b9a3d 100644 --- a/core/modules/utils/dom/popup.js +++ b/core/modules/utils/dom/popup.js @@ -110,10 +110,32 @@ Popup.prototype.popupInfo = function(domNode) { Display a popup by adding it to the stack */ Popup.prototype.show = function(options) { - // Find out what was clicked on - var info = this.popupInfo(options.domNode); - // Cancel any higher level popups - this.cancel(info.popupLevel); + var cancelLevel; + // Cancel any popups who aren't an ancestor of the current node + for(var t=0; t