Files
feuerwerk/src/core/keys.ts
T
adminandClaude Opus 5.5 ffb5bbe039
game-maker / gate (push) Successful in 3m8s
game-maker / suite (push) Failing after 8m37s
Stop a key getting stuck when Shift changes it while held (#227)
Input remembered keys under KeyboardEvent.key. Pressing a, adding
Shift and letting go sent "A" on release, which matched nothing, so
"a" stayed down until the next release without Shift.

- New rule keyName in src/core/keys.ts lowercases a single character.
  So a and A are the same key, also under Caps Lock.
- Input remembers per physical key (e.code) under which name it went
  down and releases exactly that name. So 1 released as ! is freed
  too, which lowercasing alone does not cover.
- On key down, up and held, Key is down and Axis input compare with
  the same rule. A node that already stores A reacts to a.
- Recording a key in the inspector stores Shift+A as a.
- Limit: holding Shift before pressing 1 still sends !, and a node on
  1 does not react. Nothing gets stuck by it.

Tests:
- 3 new unit tests in tests/core/behavior-events.test.ts: the flow
  from the issue, 1 released as !, and a node on A hearing a.
- Without lowercasing exactly the issue test and the A test fail.
- Without the code memory exactly the 1/! test fails.
- ./check.sh: 159 files, 2340 tests, CHECK EXIT 0 (before 2337).
- No e2e change, the check sum stays at 1377.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 18:06:16 +02:00

9 lines
385 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* The name a key goes by in the graph: `KeyboardEvent.key`, with a single character lower-cased.
* Shift and Caps Lock turn "a" into "A" on the way down or up, but it is still the same key –
* without this, a key pressed as "a" and let go as "A" would stay held (#227).
*/
export function keyName(key: string): string {
return key.length === 1 ? key.toLowerCase() : key;
}