diff --git a/src/components/common/input/CalcInput.jsx b/src/components/common/input/CalcInput.jsx index 37bd00ef..df41043f 100644 --- a/src/components/common/input/CalcInput.jsx +++ b/src/components/common/input/CalcInput.jsx @@ -340,12 +340,18 @@ export const CalculatorInput = forwardRef( // Tab 키는 계산기 숨기고 기본 동작 허용 if (e.key === 'Tab') { + if (hasOperation) { + handleCompute(true) // 계산 수행 + } setShowKeypad(false) return } // 모든 방향키는 기본 동작 허용 if (e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'ArrowUp' || e.key === 'ArrowDown') { + if (hasOperation) { + handleCompute(true) // 계산 수행 + } setShowKeypad(true) return } @@ -360,6 +366,12 @@ export const CalculatorInput = forwardRef( return } + // --- 여기서부터는 브라우저의 기본 입력을 막고 계산기 로직만 적용함 --- + if (e.key !== 'Process') { // 한글 입력 등 특수 상황 방지 (필요시) + // e.preventDefault() 호출 위치를 확인하세요. + } + + e.preventDefault() const calculator = calculatorRef.current const { allowDecimal } = options