Dungeon crawler: Shift keyup never restores walk speed after sprint #1092

Closed
opened 2026-08-13 13:58:52 +00:00 by spikerj · 1 comment
Owner

Dungeon crawler onKeyUp lowercases the key (event.key.toLowerCase()), so releasing Shift becomes "shift".

DungeonKeybindingManager.normalizeKey only lowercases single-letter keys. For "Shift" / "shift" it returns the string unchanged, so matchesAction(..., "sprint") compares stored "Shift" against input "shift" and never matches.

Result: after sprinting, releasing Shift does not restore playerCurrentSpeed to playerBaseSpeed. The player stays at 1.5× walk speed until something else resets it.

Repro (unit): playerCurrentSpeed = 12, playerBaseSpeed = 6, onKeyUp({ key: "Shift" }) → speed stays 12. Rebinding sprint to "x" and releasing x restores 6 (the restore line is reachable).

Fix: either stop lowercasing before matchesAction, or make normalizeKey case-insensitive for named keys (Shift, Space, ArrowUp, F-keys).

Dungeon crawler `onKeyUp` lowercases the key (`event.key.toLowerCase()`), so releasing Shift becomes `"shift"`. `DungeonKeybindingManager.normalizeKey` only lowercases single-letter keys. For `"Shift"` / `"shift"` it returns the string unchanged, so `matchesAction(..., "sprint")` compares stored `"Shift"` against input `"shift"` and never matches. Result: after sprinting, releasing Shift does not restore `playerCurrentSpeed` to `playerBaseSpeed`. The player stays at 1.5× walk speed until something else resets it. Repro (unit): `playerCurrentSpeed = 12`, `playerBaseSpeed = 6`, `onKeyUp({ key: "Shift" })` → speed stays 12. Rebinding sprint to `"x"` and releasing `x` restores 6 (the restore line is reachable). Fix: either stop lowercasing before `matchesAction`, or make `normalizeKey` case-insensitive for named keys (`Shift`, `Space`, `ArrowUp`, F-keys).
Author
Owner

Fixed in spikersoft-angular PR #823 (a0f0ccd9). Closing.

Fixed in `spikersoft-angular` [PR #823](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/823) (`a0f0ccd9`). Closing.
Sign in to join this conversation.