Skip to content

Commit 1a7cb32

Browse files
committed
[FIX] website: prevent duplicate notification on non-translatable els
Since [1], when clicking a non-translatable element in translation mode, the notification was sometimes shown multiple times due to event bubbling. This commit stops the click event from propagating, ensuring the notification is only triggered once. [1]: odoo@41e3411 closes odoo#221241 Signed-off-by: Romaric Moyeuvre (romo) <[email protected]>
1 parent 596937d commit 1a7cb32

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

addons/website/static/src/components/translator/translator.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,11 @@ export class WebsiteTranslator extends WebsiteEditorComponent {
282282
};
283283
for (const translationEl of $editable) {
284284
if (translationEl.closest('.o_not_editable')) {
285-
translationEl.addEventListener('click', showNotification);
285+
translationEl.addEventListener('click', (ev) => {
286+
ev.stopPropagation();
287+
ev.preventDefault();
288+
showNotification(ev);
289+
});
286290
}
287291
if (translationEl.closest('.s_table_of_content_navbar_wrap')) {
288292
// Make sure the same translation ids are used.

0 commit comments

Comments
 (0)