From 825d300a0d786d4b55137a2c2987d42cb5ab0026 Mon Sep 17 00:00:00 2001 From: Shobhit-Nagpal Date: Fri, 5 Dec 2025 00:54:40 +0530 Subject: [PATCH 1/4] refactor: don't allow time inputs to submit same value --- .../cuesheet-table/cuesheet-table-elements/DurationInput.tsx | 1 - .../cuesheet-table/cuesheet-table-elements/TimeInput.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/DurationInput.tsx b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/DurationInput.tsx index 74a28edada..b7eadb0133 100644 --- a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/DurationInput.tsx +++ b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/DurationInput.tsx @@ -94,7 +94,6 @@ function DurationInput({ diff --git a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/TimeInput.tsx b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/TimeInput.tsx index 8e7f9d132d..77c28dfdb5 100644 --- a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/TimeInput.tsx +++ b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/TimeInput.tsx @@ -96,7 +96,6 @@ function TimeInputDuration({ From 264f6af7ced54f244ebd2ef3044ce5277fe875c7 Mon Sep 17 00:00:00 2001 From: Shobhit-Nagpal Date: Wed, 10 Dec 2025 00:48:49 +0530 Subject: [PATCH 2/4] refactor: add prop for submitting only on enter and add condition for escape hotkey handler --- .../input/text-input/useReactiveTextInput.tsx | 11 ++++++++++- .../cuesheet-table-elements/DurationInput.tsx | 1 + .../cuesheet-table-elements/SingleLineCell.tsx | 1 + .../cuesheet-table-elements/TimeInput.tsx | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx b/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx index 3185e40d5d..8b4887ef85 100644 --- a/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx +++ b/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx @@ -17,6 +17,7 @@ export default function useReactiveTextInput( submitOnCtrlEnter?: boolean; onCancelUpdate?: () => void; allowSubmitSameValue?: boolean; + allowSubmitOnEnterOnly?: boolean; allowKeyboardNavigation?: boolean; }, ): UseReactiveTextInputReturn { @@ -94,7 +95,15 @@ export default function useReactiveTextInput( 'Escape', (event) => { event.preventDefault(); - handleEscape(); + if (options?.allowSubmitOnEnterOnly && text === initialText) { + isKeyboardSubmitting.current = true; + options?.onCancelUpdate?.(); + setTimeout(() => { + isKeyboardSubmitting.current = false; + }, 0); + } else { + handleEscape(); + } }, { preventDefault: true }, ], diff --git a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/DurationInput.tsx b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/DurationInput.tsx index b7eadb0133..74a28edada 100644 --- a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/DurationInput.tsx +++ b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/DurationInput.tsx @@ -94,6 +94,7 @@ function DurationInput({ diff --git a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/SingleLineCell.tsx b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/SingleLineCell.tsx index 9445b80cb2..8c49318209 100644 --- a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/SingleLineCell.tsx +++ b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/SingleLineCell.tsx @@ -20,6 +20,7 @@ const SingleLineCell = forwardRef( allowKeyboardNavigation: true, submitOnEnter: true, // single line should submit on enter submitOnCtrlEnter: true, + allowSubmitOnEnterOnly: true, onCancelUpdate: handleCancelUpdate, }); diff --git a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/TimeInput.tsx b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/TimeInput.tsx index 77c28dfdb5..8e7f9d132d 100644 --- a/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/TimeInput.tsx +++ b/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/TimeInput.tsx @@ -96,6 +96,7 @@ function TimeInputDuration({ From 28034eecb19ebc1b92b9a75a8d7a9838d096cb46 Mon Sep 17 00:00:00 2001 From: Shobhit-Nagpal Date: Wed, 10 Dec 2025 00:56:41 +0530 Subject: [PATCH 3/4] refactor: remove same value check when allowing submission with only enter --- .../common/components/input/text-input/useReactiveTextInput.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx b/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx index 8b4887ef85..7c1d867dcc 100644 --- a/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx +++ b/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx @@ -95,7 +95,7 @@ export default function useReactiveTextInput( 'Escape', (event) => { event.preventDefault(); - if (options?.allowSubmitOnEnterOnly && text === initialText) { + if (options?.allowSubmitOnEnterOnly) { isKeyboardSubmitting.current = true; options?.onCancelUpdate?.(); setTimeout(() => { From 9f68e8caa3738c7f76347231267649b219550652 Mon Sep 17 00:00:00 2001 From: Shobhit-Nagpal Date: Wed, 10 Dec 2025 01:13:58 +0530 Subject: [PATCH 4/4] refactor: add prop under dependency array --- .../common/components/input/text-input/useReactiveTextInput.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx b/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx index 7c1d867dcc..9a6beb670f 100644 --- a/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx +++ b/apps/client/src/common/components/input/text-input/useReactiveTextInput.tsx @@ -152,7 +152,7 @@ export default function useReactiveTextInput( hotKeyHandler(event); }; - }, [handleEscape, handleSubmit, options?.submitOnCtrlEnter, options?.submitOnEnter, text]); + }, [handleEscape, handleSubmit, options?.submitOnCtrlEnter, options?.submitOnEnter, options?.allowSubmitOnEnterOnly, text]); return { value: text,