fix: skip keyboard handler when focus is in a text input
All checks were successful
continuous-integration/drone/push Build is passing

Prevents useKeyboard from intercepting keypresses while the user
is typing in an input or textarea field, which caused wrong
characters to appear instead of Russian text.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alina
2026-02-18 13:43:55 +03:00
parent 68dcef3310
commit bb482902a8

View File

@ -17,6 +17,9 @@ export function useKeyboard(actions: CalculatorActions) {
const handleKeyDown = useCallback( const handleKeyDown = useCallback(
(e: KeyboardEvent) => { (e: KeyboardEvent) => {
const tag = (e.target as HTMLElement)?.tagName;
if (tag === 'INPUT' || tag === 'TEXTAREA') return;
const mapped = KEY_MAP[e.key]; const mapped = KEY_MAP[e.key];
if (!mapped) return; if (!mapped) return;