From b9ee3139233eb1e10454b3eee0f187cc27147743 Mon Sep 17 00:00:00 2001 From: Lucas Bordeau Date: Fri, 6 Sep 2024 10:23:27 +0200 Subject: [PATCH] Fixed open table cell triggering (#6910) Open table cell was triggered by a click on a field input. This is a temporary solution. I fixed it for DoubleTextInput but it might be problematic for other field types as well, we should implement a kind of bubbling shield to make sure that no click event can bubble up to trigger things like open table cell in the above components that shouldn't listen. See https://github.com/twentyhq/twenty/issues/6909 --- .../ui/field/input/components/DoubleTextInput.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/twenty-front/src/modules/ui/field/input/components/DoubleTextInput.tsx b/packages/twenty-front/src/modules/ui/field/input/components/DoubleTextInput.tsx index c0e312a92184..027371815c96 100644 --- a/packages/twenty-front/src/modules/ui/field/input/components/DoubleTextInput.tsx +++ b/packages/twenty-front/src/modules/ui/field/input/components/DoubleTextInput.tsx @@ -172,6 +172,13 @@ export const DoubleTextInput = ({ onPaste?.({ firstValue: splittedName[0], secondValue: splittedName[1] }); }; + const handleClickToPreventParentClickEvents = ( + event: React.MouseEvent, + ) => { + event.stopPropagation(); + event.preventDefault(); + }; + return ( ) => handleOnPaste(event) } + onClick={handleClickToPreventParentClickEvents} /> ) => { handleChange(firstInternalValue, event.target.value); }} + onClick={handleClickToPreventParentClickEvents} /> );