From f7703c5d9b3ccfaf16ec6a233eb71ca3d0c9cd70 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 20 Jul 2016 13:24:46 +0200 Subject: [PATCH] [FIX] web_tour: tips activation when a modal is open When a modal is open, we only activate tips that are inside the modal. The former solution didn't work when the tip's selector contains ',' (often used when the selector is different in community and enterprise, e.g. selectors for apps), because the modal restriction was only applied on the first part of the selector. --- addons/web_tour/static/src/js/tour_manager.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/web_tour/static/src/js/tour_manager.js b/addons/web_tour/static/src/js/tour_manager.js index a250274d45f..6c6cd1caf37 100644 --- a/addons/web_tour/static/src/js/tour_manager.js +++ b/addons/web_tour/static/src/js/tour_manager.js @@ -96,7 +96,7 @@ return core.Class.extend({ * active tours otherwise). Should be called each time the DOM changes. */ update: function (tour_name) { - this.in_modal = this.$body.hasClass('modal-open'); + this.$modal_displayed = $('.modal:visible').last(); tour_name = this.running_tour || tour_name; if (tour_name) { this._check_for_tooltip(this.active_tooltips[tour_name], tour_name); @@ -105,7 +105,13 @@ return core.Class.extend({ } }, _check_for_tooltip: function (tip, tour_name) { - var $trigger = $((this.in_modal ? '.modal ' : '') + tip.trigger).filter(':visible').first(); + var $trigger; + if (this.$modal_displayed.length) { + $trigger = this.$modal_displayed.find(tip.trigger); + } else { + $trigger = $(tip.trigger); + } + $trigger = $trigger.filter(':visible').first(); var extra_trigger = tip.extra_trigger ? $(tip.extra_trigger).filter(':visible').length : true; var triggered = $trigger.length && extra_trigger; if (triggered) {