Skip to content

Commit

Permalink
Fixed open table cell triggering (#6910)
Browse files Browse the repository at this point in the history
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 #6909
  • Loading branch information
lucasbordeau authored Sep 6, 2024
1 parent 338298e commit b9ee313
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ export const DoubleTextInput = ({
onPaste?.({ firstValue: splittedName[0], secondValue: splittedName[1] });
};

const handleClickToPreventParentClickEvents = (
event: React.MouseEvent<HTMLInputElement>,
) => {
event.stopPropagation();
event.preventDefault();
};

return (
<StyledContainer ref={containerRef}>
<StyledTextInput
Expand All @@ -187,6 +194,7 @@ export const DoubleTextInput = ({
onPaste={(event: ClipboardEvent<HTMLInputElement>) =>
handleOnPaste(event)
}
onClick={handleClickToPreventParentClickEvents}
/>
<StyledTextInput
autoComplete="off"
Expand All @@ -197,6 +205,7 @@ export const DoubleTextInput = ({
onChange={(event: ChangeEvent<HTMLInputElement>) => {
handleChange(firstInternalValue, event.target.value);
}}
onClick={handleClickToPreventParentClickEvents}
/>
</StyledContainer>
);
Expand Down

0 comments on commit b9ee313

Please sign in to comment.