diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 8ffb992f94e..00d86c6240c 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -705,7 +705,13 @@ var SnippetEditor = Widget.extend({ const proms = Object.values(this.styles).map(opt => { return opt.updateUIVisibility(); }); - return Promise.all(proms); + await Promise.all(proms); + // Hide the snippetEditor if none of its options are visible + // This cannot be done using the visibility of the options' UI + // because some options can be located in the overlay. + const $visibleOptions = this.$optionsSection.find('we-top-button-group, we-customizeblock-option') + .children(':not(.d-none)'); + this.$optionsSection.toggleClass('d-none', !$visibleOptions.length); }, /** * Clones the current snippet. 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 a9075890a9d..8c44e98fb62 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -5133,17 +5133,6 @@ registry.SnippetMove = SnippetOptionWidget.extend({ return this._super(...arguments); }, - /** - * @override - */ - onFocus: function () { - // TODO improve this: hack to hide options section if snippet move is - // the only one. - const $allOptions = this.$el.parent(); - if ($allOptions.find('we-customizeblock-option').length <= 1) { - $allOptions.addClass('d-none'); - } - }, //-------------------------------------------------------------------------- // Options