From 87323e36e0a2ad874de05247bc7f9fbe0cec873e Mon Sep 17 00:00:00 2001 From: FrancoisGe Date: Wed, 26 Jan 2022 10:46:46 +0000 Subject: [PATCH] [FIX] web_tour: make tour manager more robust Before this commit, it could happen that the trigger element of a step was in the DOM at time t0, but was no longer in the DOM at time t1, when we tried to actually execute the step, because of a non zero running_step_delay. This commit checks again the presence of the trigger in the DOM at t1, and if it isn't resets the step. The same reasonning applies to the ui blocked check: we never want to run a step if the ui is blocked. X-original-commit: 119d509feb2cb93c648160af2848146e9c623e21 Part-of: odoo/odoo#85573 --- addons/web_tour/static/src/js/tour_manager.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/web_tour/static/src/js/tour_manager.js b/addons/web_tour/static/src/js/tour_manager.js index a7ebe558208..8b369eb6e94 100644 --- a/addons/web_tour/static/src/js/tour_manager.js +++ b/addons/web_tour/static/src/js/tour_manager.js @@ -507,6 +507,15 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, { } function exec() { + const anchorIsInDocument = tip.widget.$anchor[0].ownerDocument.contains(tip.widget.$anchor[0]); + const uiIsBlocked = $('body').hasClass('o_ui_blocked'); + if (!anchorIsInDocument || uiIsBlocked) { + // trigger is no longer in the DOM, or UI is now blocked, so run the same step again + self._deactivate_tip(self.active_tooltips[tour_name]); + self._to_next_step(tour_name, 0); + self.update(); + return; + } var action_helper = new RunningTourActionHelper(tip.widget); do_before_unload(self._consume_tip.bind(self, tip, tour_name));