From 7cb4145e6406db6f4ba56120767a2b4d0d94387a Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Mon, 26 May 2025 16:40:37 +0300 Subject: [PATCH] fix: prevent checkbox and radio changing in design mode User can click on checkboxes and radio inputs and make them checked. We don't want this in design mode. --- apps/builder/app/canvas/interceptor.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/builder/app/canvas/interceptor.ts b/apps/builder/app/canvas/interceptor.ts index c7d42c4f7c4c..3421c63d8584 100644 --- a/apps/builder/app/canvas/interceptor.ts +++ b/apps/builder/app/canvas/interceptor.ts @@ -76,13 +76,12 @@ const switchPageAndUpdateSystem = (href: string, formData?: FormData) => { export const subscribeInterceptedEvents = () => { const handleClick = (event: MouseEvent) => { - // Prevent forwarding the click event on an input element when the associated label has a "for" attribute - if ( - event.target instanceof Element && - event.target.closest("label[for]") && - !$isPreviewMode.get() - ) { - event.preventDefault(); + if (event.target instanceof Element && !$isPreviewMode.get()) { + // Prevent forwarding the click event on an input element when the associated label has a "for" attribute + // and prevent checkbox or radio inputs changing when clicked + if (event.target.closest("label[for]") || event.target.closest("input")) { + event.preventDefault(); + } } if (