Skip to content

Commit 321ac4f

Browse files
bso-odooFrancoisGe
authored andcommitted
[FIX] website: avoid infinite wait for carousel slide operation
pre-forward port of 208853
1 parent 56de71e commit 321ac4f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

addons/website/static/src/core/website_edit_service.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,18 @@ registry.category("services").add("website_edit", {
122122
return (...args) => historyCallbacks.ignoreDOMMutations(() => fn(...args));
123123
},
124124
addListener(target, event, fn, options) {
125-
fn = fn.bind(this.interaction);
125+
const boundFn = fn.bind(this.interaction);
126+
if (event.startsWith("slide.bs.carousel")) {
127+
// Never allow cancelling this event in edit mode.
128+
fn = (...args) => {
129+
const ev = args[0];
130+
ev.preventDefault = () => {};
131+
ev.stopPropagation = () => {};
132+
return boundFn(...args);
133+
};
134+
} else {
135+
fn = boundFn;
136+
}
126137
let stealth = true;
127138
const parts = event.split(".");
128139
if (parts.includes("keepInHistory") || options?.keepInHistory) {

addons/website/static/src/interactions/carousel/carousel_slider.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Interaction } from "@web/public/interaction";
22
import { registry } from "@web/core/registry";
3+
import { onceAllImagesLoaded } from "@website/utils/images";
34

45
export class CarouselSlider extends Interaction {
56
static selector = ".carousel";
@@ -97,6 +98,11 @@ export class CarouselSlider extends Interaction {
9798
// If images are loading, prevent the slide transition. It will
9899
// slide once the next images are loaded.
99100
ev.preventDefault();
101+
onceAllImagesLoaded(this.carouselInnerEl).then(
102+
() => {
103+
Carousel.getOrCreateInstance(this.el).to(ev.to);
104+
}
105+
);
100106
return;
101107
}
102108
if (this.options.scrollMode === "single") {

0 commit comments

Comments
 (0)