Bug: Space Game - clicking the viewport grabs pointer lock and makes modal HUDs (e.g. "Select Your Ship") unclickable; add keyboard navigation #224

Closed
opened 2026-06-15 00:12:04 +00:00 by spikerj · 1 comment
Owner

Severity

High — can fully block progress (stuck on the "SELECT YOUR SHIP" screen, unable to click any menu item).

Area

Space Game / native WebGL HUD modals (ship selection, ship creation, keybinding config) + input handling.

Bug

When a blocking modal HUD is open (e.g. Select Your Ship) and the user clicks anywhere on the WebGL viewport outside the modal, the canvas calls requestPointerLock(). Pointer lock hides the cursor and freezes event.clientX/clientY, so the modal's hit-tests can never match again — the menu items (Select Ship / Create New / Delete / ship rows / close) become unclickable and the player is stuck.

Steps to reproduce

  1. Open the Space Game.
  2. On the "Select Your Ship" modal, click on the empty canvas area (not on the modal).
  3. Pointer lock engages; cursor disappears.
  4. Modal buttons no longer respond to clicks.

Expected

While a blocking modal HUD is open, the canvas should not grab pointer lock (and should release it if already held), so the modal stays fully clickable.

Enhancement (same scope)

These WebGL modals should also be keyboard navigable:

  • Arrow Up/Down: move ship selection
  • Enter: Select Ship (or Create New when there are no ships)
  • Delete/Backspace: open delete confirmation
  • Escape: close (or cancel the delete confirmation)
  • N: Create New

Pointers

  • projects/spikersoft/src/app/_components/_games/space-game/space-game.component.tsonMouseDown() requests pointer lock; onKeyDown() / handleHUDInterceptKeyDown() routes keys to HUDs.
  • projects/spikersoft/src/app/_components/_games/space-game/hud/ship-selection-hud.ts — modal hit-testing; needs a handleKeyDown().
## Severity High — can fully block progress (stuck on the "SELECT YOUR SHIP" screen, unable to click any menu item). ## Area Space Game / native WebGL HUD modals (ship selection, ship creation, keybinding config) + input handling. ## Bug When a blocking modal HUD is open (e.g. **Select Your Ship**) and the user clicks anywhere on the WebGL viewport *outside* the modal, the canvas calls `requestPointerLock()`. Pointer lock hides the cursor and freezes `event.clientX/clientY`, so the modal's hit-tests can never match again — the menu items (Select Ship / Create New / Delete / ship rows / close) become unclickable and the player is stuck. ### Steps to reproduce 1. Open the Space Game. 2. On the "Select Your Ship" modal, click on the empty canvas area (not on the modal). 3. Pointer lock engages; cursor disappears. 4. Modal buttons no longer respond to clicks. ### Expected While a blocking modal HUD is open, the canvas should not grab pointer lock (and should release it if already held), so the modal stays fully clickable. ## Enhancement (same scope) These WebGL modals should also be **keyboard navigable**: - Arrow Up/Down: move ship selection - Enter: Select Ship (or Create New when there are no ships) - Delete/Backspace: open delete confirmation - Escape: close (or cancel the delete confirmation) - N: Create New ## Pointers - `projects/spikersoft/src/app/_components/_games/space-game/space-game.component.ts` — `onMouseDown()` requests pointer lock; `onKeyDown()` / `handleHUDInterceptKeyDown()` routes keys to HUDs. - `projects/spikersoft/src/app/_components/_games/space-game/hud/ship-selection-hud.ts` — modal hit-testing; needs a `handleKeyDown()`.
Author
Owner

Resolved in spikersoft-angular PR #47 (merged to master). The viewport no longer grabs pointer lock while a blocking modal HUD is open — and releases it if already held — so the Select Your Ship modal stays clickable. The Ship Selection HUD is also keyboard-navigable now: Arrow Up/Down to move, Enter to select (or create when no ships), Delete/Backspace to open delete confirmation, Esc to close/cancel, N to create. Closing.

Resolved in `spikersoft-angular` PR #47 (merged to `master`). The viewport no longer grabs pointer lock while a blocking modal HUD is open — and releases it if already held — so the **Select Your Ship** modal stays clickable. The Ship Selection HUD is also keyboard-navigable now: Arrow Up/Down to move, Enter to select (or create when no ships), Delete/Backspace to open delete confirmation, Esc to close/cancel, N to create. Closing.
Sign in to join this conversation.