KeyboardShortcuts service registers a global keydown listener on window and maps digit keys to Stremio Web navigation routes. It is intentionally minimal — no configuration, no shortcut registration API — just a lifecycle (start/stop) and a stateChanged event.
Constructor
Properties
true when the service has registered its keydown listener on window. false before start() or after stop().Methods
start()
Adds the global keydown event listener. Does nothing if already active.
stop()
Removes the global keydown event listener and sets active to false.
Events
Emitted when
active changes (i.e., after start() or stop()).KeyboardShortcuts uses an internal EventEmitter but does not expose on/off methods publicly. The stateChanged event is an internal signal used by the application shell. External consumers should observe core.active or similar top-level state instead.Registered shortcuts
The handler fires onkeydown. All shortcuts are suppressed when any of the following are true:
event.keyboardShortcutPreventedistrue(allows components to opt out)event.target.tagName === 'INPUT'(prevents hijacking text input)- Any modifier key is held:
ctrlKey,altKey,shiftKey, ormetaKey
The
Backspace key handling is a special case — it reads event.ctrlKey inside the handler body after the modifier check has already gated entry. In practice, Backspace with Ctrl held will not fire because ctrlKey is caught by the outer guard. The Ctrl+Backspace branch is therefore unreachable in the current implementation.Navigation shortcuts
| Key | Route | Description |
|---|---|---|
0 | #/search | Search |
1 | #/ | Board (home) |
2 | #/discover | Discover |
3 | #/library | Library |
4 | #/calendar | Calendar |
5 | #/addons | Add-ons |
6 | #/settings | Settings |
Backspace | history.back() | Navigate back |
event.preventDefault() to suppress browser defaults before changing window.location.
Opting out of shortcuts in a component
Setevent.keyboardShortcutPrevented = true on a synthetic or native keyboard event before it bubbles to window to prevent the service from handling it:
