Fix: global keydown hotkeys ate letters while typing in the name input
R/N/P/F/G/W/A/S/D and arrows all preventDefault()'d unconditionally, even with focus in #settings-name-input — swallowed those letters mid-typing (very noticeable for English names). Skip the hotkey handler entirely when an <input> is focused.
This commit is contained in:
@@ -2065,6 +2065,10 @@ function draw() {
|
|||||||
// ============ ВВОД ============
|
// ============ ВВОД ============
|
||||||
const keys = {};
|
const keys = {};
|
||||||
window.addEventListener('keydown', e => {
|
window.addEventListener('keydown', e => {
|
||||||
|
// фокус в текстовом поле (например, ввод имени) — не перехватываем хоткеи,
|
||||||
|
// иначе R/N/P/F/G/W/A/S/D и стрелки режут буквы прямо во время печати
|
||||||
|
if (document.activeElement && document.activeElement.tagName === 'INPUT') return;
|
||||||
|
|
||||||
const key = e.key.toLowerCase();
|
const key = e.key.toLowerCase();
|
||||||
|
|
||||||
if (key === 'escape' && (solveState || pendingSolution)) { cancelAutoSolve(); e.preventDefault(); return; }
|
if (key === 'escape' && (solveState || pendingSolution)) { cancelAutoSolve(); e.preventDefault(); return; }
|
||||||
|
|||||||
Reference in New Issue
Block a user