Skip to content

Game thinks ⌘/Ctrl and ⇧ are still held after release #6122

Open

Description

@francisashley

Describe the bug

Sometimes the game acts as if ⌘ and ⇧ are still held down after you've let go, this results in:

  • Clicking the map opens the build menu instead of attacking.
  • Dragging the map draws a warship selection box instead of moving the map.

The only way out is to press and release ⌘ and ⇧ again.

I've seen this happen before, for example after swiping between fullscreen apps, but I could never reproduce it. Taking a screenshot with ⌘⇧4 on macOS is the first way I've found to trigger it every time.

Screen.Recording.2026-10-25.at.10.15.17.mp4

I reported this on Discord as well: https://discord.com/channels/1284581928254701718/1525106712288297081. Other players there say they've had the same problem on Windows, so it isn't only a Mac bug. I'm on macOS, though, so that's what I've tested.

To Reproduce

  1. On a Mac, start a game and pick your spawn.
  2. Press ⌘⇧4 (the macOS screenshot shortcut), then Esc.
  3. Click the map: the build menu opens.
  4. Drag the map: a selection box appears and the cursor stays a crosshair.

Expected behavior

Clicking the map without holding ⌘ should attack, and dragging without holding ⇧ should move the map.

When it was introduced

The game has tracked held keys in its own list, activeKeys in src/client/InputHandler.ts, since keyboard pan and zoom were added. A stale entry in that list only became a problem once mouse actions started reading it: Shift+drag warship box-select in #3677 (merged 21 April 2026), then the ⌘+click build menu in #4175 (merged 7 June 2026). Before #4175, the click handler read event.metaKey from the click itself, which always matches the real keyboard.

Why it happens

A key is added to activeKeys on keydown and removed on keyup. The list is also cleared when the window loses focus.

⌘⇧4 opens the macOS screenshot tool, which takes over the keyboard. The page never gets the keyup for ⌘ or ⇧, and the window doesn't lose focus, so both keys stay in the list.

Desktop

  • OS: macOS 15.6.1
  • Browser: Chrome
  • Version: 156.0.8078.47

Smartphone

N/A

Additional context

Discord bug report: https://discord.com/channels/1284581928254701718/1525106712288297081

Assignment

  • I'd like to be assigned to this issue and work on it myself

Activity

  1. github-actions commented on Oct 25, 2026

    @github-actions
    Contributor

    Hi @francisashley, thanks for opening this issue. It hasn't been approved by a maintainer yet — we'll get back to you shortly to either milestone it (approval) or close it.

    — Automated. See CONTRIBUTING.md.

  2. francisashley commented on Oct 25, 2026

    @francisashley
    Author

    I have come up with a solution here #6124

  3. added
    StalePRs that haven't been touched for over two weeks.
    on Nov 1, 2026
  4. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    Hi @francisashley, this issue hasn't had activity in 7 days and doesn't yet have a milestone assigned.

    If a maintainer doesn't milestone this issue (or you don't update it) within the next 7 days, it will be automatically closed.

    If you believe this issue is important, consider:

    • Adding more context, repro steps, or examples
    • Discussing in our Discord
    • Requesting the keep-open label if it should be exempt from auto-close

    — Automated. See CONTRIBUTING.md.

  5. added this to the Backlog milestone on Nov 6, 2026
  6. added
    approvedApproved for a PR, if you assigned to the issue.
    and removed
    not-approvedThis issue has NOT been approved by the maintainers.
    on Nov 6, 2026
  7. changed the title [-]macOS: ⌘ and ⇧ can get stuck, so clicking opens the build menu and dragging draws a selection box[/-] [+]Game thinks ⌘/Ctrl and ⇧ are still held after release[/+] on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    StalePRs that haven't been touched for over two weeks.approvedApproved for a PR, if you assigned to the issue.

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions