1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

refactor: fix form submission avoidance on add constraint (#783)

This commit is contained in:
olav 2022-03-14 10:24:39 +01:00 committed by GitHub
parent 22f538562d
commit bc9ae12683

View File

@ -55,10 +55,9 @@ export const FreeTextInput = ({
const [inputValues, setInputValues] = useState('');
const styles = useStyles();
const onKeyDown = (event: React.KeyboardEvent) => {
event.stopPropagation();
const onKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (event.key === ENTER) {
event.preventDefault();
addValues();
}
};
@ -91,7 +90,7 @@ export const FreeTextInput = ({
<div className={styles.inputContainer}>
<div className={styles.inputInnerContainer}>
<Input
onKeyDown={onKeyDown}
onKeyPress={onKeyPress}
label="Values"
name="values"
value={inputValues}