diff --git a/client/core/src/popover/popover.js b/client/core/src/popover/popover.js index 7e5b812adf..78d8b62208 100644 --- a/client/core/src/popover/popover.js +++ b/client/core/src/popover/popover.js @@ -136,13 +136,14 @@ export class Popover { } this._checkOpens(); } - hideOthers(id) { + hideChilds(id) { let popovers = this.document.querySelectorAll('*[id^="popover-"]'); + let idNumber = parseInt(id.split('-')[1], 10); popovers.forEach( val => { - if (angular.element(val).attr('id') != id) { + let valId = angular.element(val).attr('id'); + if (parseInt(valId.split('-')[1], 10) > idNumber) this._removeElement(val); - } } ); this._checkOpens(); @@ -169,7 +170,7 @@ export class Popover { onDocMouseDown(event) { let targetId = this._findParent(event.target); if (targetId) { - this.hideOthers(targetId); + this.hideChilds(targetId); } else { this.hideAll(); } @@ -178,7 +179,7 @@ export class Popover { if (event.keyCode === 27) { let targetId = this._findParent(this.latTarget); if (targetId) { - this.hideOthers(targetId); + this.hideChilds(targetId); } else { this.hideAll(); }