From 225ef1620339f05210b40b291cdf13d06a26e09d Mon Sep 17 00:00:00 2001 From: "Arthur Detroux (ard)" Date: Tue, 11 Oct 2022 08:46:34 +0000 Subject: [PATCH] [FIX] web_editor: dispose of the tooltip when closing the bg-overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the migration to Bootstrap 5 (at [1]), the tooltip for the background position overlay was no longer disposed when toggling the overlay back on. This meant that new tooltips kept being added and could lead to a very confusing user interface. This was fixed for legacy widgets at [2] but the tooltip for the overlay is a specific case. This commit makes disabling the overlay also dispose of the tooltip. Steps to reproduce: - Edit a website and drop a cover snippet - Toggle the background position overlay (by clicking on the target icon) - Close the overlay (discard, save or click on the editor) - Change the Parallax option from fixed to Top to Bottom (this is just so that the previous tooltip is clearly visible after the next step) - Toggle the background overlay again => The old tooltip is still present and a new one is visible [1]: https://github.com/odoo/odoo/commit/1fcd098af5fa18e848c66bb83bdceb6ba0308512 [2]: https://github.com/odoo/odoo/commit/3c01b1cd77adec146b1a90f96bb1223a2108678b task-3119958 closes odoo/odoo#110170 X-original-commit: 2ddffeef579baf47ff117b133a9d4fbf12108a2c Signed-off-by: Bojabza Soukéina (sobo) --- addons/web_editor/static/src/js/editor/snippets.options.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 45b9bfc4706..e7468e21050 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -7222,6 +7222,9 @@ registry.BackgroundPosition = SnippetOptionWidget.extend({ this.trigger_up('activate_snippet', {$snippet: this.$target}); $(document).off('click.bgposition'); + if (this.$bgDragger) { + this.$bgDragger.tooltip('dispose'); + } return; }