Skip to content

Commit 19c41b9

Browse files
authored
Implemented handleKeyDown handler for textfield to handle enter key press. (#335)
1 parent f5d7c19 commit 19c41b9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

frontend/src/packages/dashboard/components/ConfirmationModal/ConfirmationWindow.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ export default function ConfirmationWindow({
7777
setInputValue(value);
7878
};
7979

80+
const handleKeyDown = (e: React.KeyboardEvent) => {
81+
if (e.key === 'Enter') {
82+
handleSubmit();
83+
}
84+
}
85+
8086
return (
8187
<Modal
8288
open={open}
@@ -93,6 +99,7 @@ export default function ConfirmationWindow({
9399
<TextField
94100
value={inputValue}
95101
onChange={handleChange}
102+
onKeyDown={handleKeyDown}
96103
sx={{ marginRight: "10px" }}
97104
/>
98105
<Button background="#73EEDC" onClick={handleSubmit}>

0 commit comments

Comments
 (0)