탭키, 방향키 계산
This commit is contained in:
parent
4651ebc365
commit
a258f61093
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user