From 4bd144d079481e12d04071f18990477668be9ffb Mon Sep 17 00:00:00 2001 From: ulferts Date: Fri, 6 Dec 2024 13:46:35 +0100 Subject: [PATCH] exclude OP custom dom elements from being morphed --- frontend/src/turbo/turbo-global-listeners.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/src/turbo/turbo-global-listeners.ts b/frontend/src/turbo/turbo-global-listeners.ts index 1b715fe5c1ba..0f379be56818 100644 --- a/frontend/src/turbo/turbo-global-listeners.ts +++ b/frontend/src/turbo/turbo-global-listeners.ts @@ -64,4 +64,13 @@ export function addTurboGlobalListeners() { activateFlashNotice(); activateFlashError(); }); + + document.addEventListener('turbo:before-morph-element', (event) => { + const element = event.target as HTMLElement; + + // In case the element is an OpenProject custom dom element, morphing is prevented. + if (element.tagName.startsWith('OPCE-')) { + event.preventDefault(); + } + }); }