From e7bdf7e0a296356de4f7b422b28d6179efc56a22 Mon Sep 17 00:00:00 2001 From: joarthvr Date: Mon, 9 Dec 2024 23:01:36 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=ED=83=9C=ED=81=AC=20=ED=82=A4?= =?UTF-8?q?=EC=94=B9=ED=9E=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/gathering/ui/GatheringTagInput.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/features/gathering/ui/GatheringTagInput.tsx b/src/features/gathering/ui/GatheringTagInput.tsx index b7b6b93..fce404a 100644 --- a/src/features/gathering/ui/GatheringTagInput.tsx +++ b/src/features/gathering/ui/GatheringTagInput.tsx @@ -25,13 +25,16 @@ export const GatheringTagInput = ({ placeholder = '태그를 입력해주세요', }: GatheringTagInputProps) => { const [inputValue, setInputValue] = useState(''); + const [isComposing, setIsComposing] = useState(false); const handleKeyDown = ( e: KeyboardEvent, onChange: HandleChangeFunction, currentValue: string[], ) => { - if ((e.key === 'Enter' || (e.metaKey && e.key === 'Enter')) && inputValue.trim()) { + if (isComposing) return; + + if (e.key === 'Enter' && inputValue.trim()) { e.preventDefault(); if (currentValue.length >= 3) { return; @@ -70,6 +73,12 @@ export const GatheringTagInput = ({ onChange={e => { setInputValue(e.target.value); }} + onCompositionEnd={() => { + setIsComposing(false); + }} + onCompositionStart={() => { + setIsComposing(true); + }} onKeyDown={e => { handleKeyDown(e, onChange, value || []); }}