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 feafcd135c3..4cde497dfe4 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -6567,8 +6567,13 @@ registry.BackgroundOptimize = ImageHandlerOption.extend({ */ async _loadImageInfo() { this.img = new Image(); + // In the case of a parallax, the background of the snippet is actually + // set on a child and should be focused here. This is necessary + // because, at this point, the $target has not yet been updated in the + // notify() method ("option_update" event), although the event is + // properly fired from the parallax. const targetEl = this.$target[0].classList.contains("oe_img_bg") - ? this.$target[0] : this.$target[0].querySelector(".oe_img_bg"); + ? this.$target[0] : this.$target[0].querySelector(":scope > .s_parallax_bg.oe_img_bg"); if (targetEl) { Object.entries(targetEl.dataset).filter(([key]) => isBackgroundImageAttribute(key)).forEach(([key, value]) => { @@ -6626,6 +6631,7 @@ registry.BackgroundOptimize = ImageHandlerOption.extend({ * @private */ async _onBackgroundChanged(ev, previewMode) { + ev.stopPropagation(); if (!previewMode) { this.trigger_up('snippet_edition_request', {exec: async () => { await this._autoOptimizeImage();