Skip to content

Commit b35b8fd

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#221384 X-original-commit: 1a7cb32 Signed-off-by: Romaric Moyeuvre (romo) <[email protected]> Signed-off-by: Serge Bayet (seba) <[email protected]>
1 parent 28e4ef3 commit b35b8fd

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
@@ -275,7 +275,11 @@ export class WebsiteTranslator extends WebsiteEditorComponent {
275275
};
276276
for (const translationEl of $editable) {
277277
if (translationEl.closest('.o_not_editable')) {
278-
translationEl.addEventListener('click', showNotification);
278+
translationEl.addEventListener('click', (ev) => {
279+
ev.stopPropagation();
280+
ev.preventDefault();
281+
showNotification(ev);
282+
});
279283
}
280284
if (translationEl.closest('.s_table_of_content_navbar_wrap')) {
281285
// Make sure the same translation ids are used.

0 commit comments

Comments
 (0)