Skip to content

Commit

Permalink
Fix issue where pressing Enter in text wait code overlay would cause …
Browse files Browse the repository at this point in the history
…project to show "Loading" message
  • Loading branch information
chrismaltby committed Nov 11, 2024
1 parent c53b124 commit 85d1cf7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/forms/TextWaitTimeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ export const TextWaitTimeSelect = ({
[debouncedLeave]
);

const blockSubmit = useCallback((e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
e.stopPropagation();
}, []);

return (
<Form onFocus={onFocus} onBlur={onFocusOut}>
<Form onFocus={onFocus} onBlur={onFocusOut} onSubmit={blockSubmit}>
<FormRow>
<FormField
name="replaceWaitTime"
Expand All @@ -86,7 +91,10 @@ export const TextWaitTimeSelect = ({
id="replaceWaitTime"
value={value}
onChange={(e) => {
const value = ensureNumber(parseFloat(e.currentTarget.value), 0);
const value = Math.max(
0,
ensureNumber(parseFloat(e.currentTarget.value), 0)
);
onChange(value);
}}
autoFocus
Expand Down

0 comments on commit 85d1cf7

Please sign in to comment.