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
This commit is contained in:
@ -172,6 +172,13 @@ export const DoubleTextInput = ({
|
|||||||
onPaste?.({ firstValue: splittedName[0], secondValue: splittedName[1] });
|
onPaste?.({ firstValue: splittedName[0], secondValue: splittedName[1] });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleClickToPreventParentClickEvents = (
|
||||||
|
event: React.MouseEvent<HTMLInputElement>,
|
||||||
|
) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledContainer ref={containerRef}>
|
<StyledContainer ref={containerRef}>
|
||||||
<StyledTextInput
|
<StyledTextInput
|
||||||
@ -187,6 +194,7 @@ export const DoubleTextInput = ({
|
|||||||
onPaste={(event: ClipboardEvent<HTMLInputElement>) =>
|
onPaste={(event: ClipboardEvent<HTMLInputElement>) =>
|
||||||
handleOnPaste(event)
|
handleOnPaste(event)
|
||||||
}
|
}
|
||||||
|
onClick={handleClickToPreventParentClickEvents}
|
||||||
/>
|
/>
|
||||||
<StyledTextInput
|
<StyledTextInput
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
@ -197,6 +205,7 @@ export const DoubleTextInput = ({
|
|||||||
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
||||||
handleChange(firstInternalValue, event.target.value);
|
handleChange(firstInternalValue, event.target.value);
|
||||||
}}
|
}}
|
||||||
|
onClick={handleClickToPreventParentClickEvents}
|
||||||
/>
|
/>
|
||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user