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 8949108d944..36321199aa5 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -2948,7 +2948,18 @@ var SnippetsMenu = Widget.extend({ if (!ev.currentTarget.classList.contains('active')) { this._activateSnippet(false); this._mutex.exec(() => { - this._activateEmptyOptionsTab(); + let $pageOptionsTarget = $(); + let i = 0; + const pageOptions = this.templateOptions.filter(template => template.data.pageOptions); + while (!$pageOptionsTarget.length && i < pageOptions.length) { + $pageOptionsTarget = pageOptions[i].selector.all(); + i++; + } + if ($pageOptionsTarget.length) { + this._activateSnippet($pageOptionsTarget); + } else { + this._activateEmptyOptionsTab(); + } }); } }, diff --git a/addons/web_editor/views/snippets.xml b/addons/web_editor/views/snippets.xml index 91e1c96c2a4..30c556138cb 100644 --- a/addons/web_editor/views/snippets.xml +++ b/addons/web_editor/views/snippets.xml @@ -18,7 +18,7 @@ Blocks