From 71b8985c1722f374e0ca4593dc6bdd97a8fc5d39 Mon Sep 17 00:00:00 2001 From: wait4xx Date: Sun, 25 Oct 2026 21:18:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(keyboard):=20g=20g=20chord=20=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E8=BE=BE=E2=80=94=E2=80=94=E8=B7=AF=E7=94=B1=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=85=88=E4=BA=8E=E6=AD=A6=E8=A3=85=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 1 潜伏缺陷:g 键分支先于路由检查 return,第二击 g 永远 重新武装,routes['g'](gallery)全站不可达。修序即愈,g→g 自身 是合法 chord。en 轨随上一提交前缀化后同步受益。 验证: chord 矩阵 5 检(zh/en × g g/g h/g m 实跳目标全中); E2E 31/31 PASS Spec: none (keydown 分支修序,矩阵测试入档) Co-authored-by: GLM-5.3 --- src/components/geek/Keyboard.astro | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/geek/Keyboard.astro b/src/components/geek/Keyboard.astro index 8d693b8..bada4da 100644 --- a/src/components/geek/Keyboard.astro +++ b/src/components/geek/Keyboard.astro @@ -67,15 +67,19 @@ const routes: Record = { (document.getElementById('kbd-help') as HTMLDialogElement | null)?.showModal(); return; } + // 路由判断必须先于 g 武装分支:g→g 自身也是合法 chord(gallery), + // 原序里第二击 g 永远重新武装、routes['g'] 不可达——Phase 1 潜伏缺陷 + // (g g 全站失灵实锤于 2026-10-25 矩阵测试) + if (chord === 'g' && routes[e.key]) { + location.href = routes[e.key]!; + chord = ''; + clearTimeout(chordTimer); + return; + } if (e.key === 'g') { chord = 'g'; clearTimeout(chordTimer); chordTimer = window.setTimeout(() => (chord = ''), 300); - return; - } - if (chord === 'g' && routes[e.key]) { - location.href = routes[e.key]!; - chord = ''; } });