Skip to content

Flash the browser tab (title + icon) when the game is starting or a spawn still needs to be picked (optional setting) #6374

Open

Description

@oncenot0

Purpose

Add an optional tab alert so players who switched to another tab don't miss that the game is starting or that they still have to pick a spawn.


Objectives

  • Flash the tab title and favicon while the tab is in the background and the game is starting.
  • Keep flashing during the spawn phase until the player has spawned.
  • Alternate the favicon between the game's normal icon (black tile) and the same icon on a white tile, so the blink is visible in the tab strip. The ship keeps the same size and position in both states.
  • Make it optional with a toggle in Settings (on by default).
  • Stop and restore the original title and icon as soon as the tab is visible again, the player spawns, the game ends, the setting is turned off, or after a 2 minute safety timeout.
  • Do not change the existing favicon asset.

Description

The game already has an opt-in alert for when a lobby starts (the bell, which plays a chime and can show a desktop notification). This adds a silent, visual alternative: the tab title and icon blink, with no sound or notification. It also covers the spawn phase, where players who have switched tabs can still miss the moment they need to pick a spawn, and the bell doesn’t cover that.

Behaviour

  • Only active while document.hidden is true. Nothing happens in a visible tab.
  • Title alternates between the page title and a message: "Game starting!" before the spawn phase, "Choose your spawn!" during it.
  • Favicon alternates between the original icon (restored exactly from the page's <link rel="icon">) and an alert icon. The alert icon is the same ship pixels with the same padded -2 -2 15 15 framing as Favicon.svg, on a white tile instead of black.
  • Blink rate is 2 per second (flips every 250 ms, so a full cycle is 500 ms).
  • Resumes if the player leaves the tab again while still needing to act.
  • Gives up after 2 minutes so a background tab never blinks forever.
Image

Setting

  • New toggle in Settings: "Flash Tab When Game Starts" (settings.tabAttention, default ON).
  • Checked on every request and on every blink, so turning it off takes effect immediately.

Implementation

  • New src/client/TabAttention.ts: small class with request(kind) / release(), driven by visibilitychange and focus, and an injected isEnabled check. The alert icon is an inline SVG that is converted to a PNG data URL via canvas once available, since not every browser draws SVG favicons from data URIs reliably.
  • src/client/UserSettings.ts: tabAttention() / toggleTabAttention().
  • src/client/UserSettingModal.ts: the new toggle.
  • src/client/Main.ts: tabAttention.request("starting") when the game-starting event fires.
  • src/client/ClientGameRunner.ts: request/release each tick based on inSpawnPhase() and myPlayer()?.hasSpawned(), and release in stop().
  • resources/lang/en.json: tab_attention.starting, tab_attention.pick_spawn, user_setting.tab_attention_label, user_setting.tab_attention_desc.
  • tests/client/TabAttention.test.ts: unit tests for visible/hidden behaviour, alternation, restore on show/release, the timeout, and the setting being off or switched off mid-flash.

Testing done

  • Unit tests pass (10).
  • Run in headless Chromium against the repo's real Favicon.svg: the icon and title flip every ~250 ms, the ship's pixel bounds are identical in both states (only the tile changes black to white), and the original icon and title are restored exactly on release.

Notes

  • Browsers throttle timers in background tabs, so the real blink rate may be a bit slower than 2 per second.
  • Other languages only need the new keys translated (English is the fallback).

Assignment

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

[oncenot]

Activity

  1. github-actions commented on Nov 10, 2026

    @github-actions
    Contributor

    Hi @oncenot0, 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. added this to the Backlog milestone on Nov 10, 2026
  3. 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 10, 2026
  4. VariableVince commented on Nov 10, 2026

    @VariableVince
    Contributor

    There is a cue though when a game starts in the background. There's the notification bell you can tick for it in a lobby, and it also has a permanent on setting.

    A flashing browser tab would help locate which one has the starting game. But the description here says "Right now there is no cue when the game starts while the tab is in the background" and that's not true.

    So it'll be on top of the current sound notification and popup, flashing the tab won't be the only notification. It could be wired into existing code for it, maybe

  5. oncenot0 commented on Nov 10, 2026

    @oncenot0
    Author

    There is a cue though when a game starts in the background. There's the notification bell you can tick for it in a lobby, and it also has a permanent on setting.

    A flashing browser tab would help locate which one has the starting game. But the description here says "Right now there is no cue when the game starts while the tab is in the background" and that's not true.

    So it'll be on top of the current sound notification and popup, flashing the tab won't be the only notification. It could be wired into existing code for it, maybe

    Thanks for pointing that out. I missed that the bell alert already exists, so I’ve corrected the issue description. This is meant as a silent, visual alternative: it blinks the tab title and icon, with no sound or desktop notification, and it also reminds you to pick your spawn after the game starts, which the bell doesn’t cover. Since the bell turns on a chime and a notification together, I’m keeping this as its own setting so people can have the blink without the sound.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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