Keyboard Lock
Lets a fullscreen page capture shortcut keys like Esc, Alt+Tab or Ctrl+W (Chromium only).
In one line
Can capture shortcut keys like Esc or Ctrl+W, but only in fullscreen on Chromium
Lets a fullscreen page capture shortcut keys like Esc, Alt+Tab or Ctrl+W (Chromium only).
A site can keep keys the browser or OS would normally take, which remote desktops, games and cloud IDEs need. It also lets a hostile fullscreen page swallow the usual escape shortcuts for a moment.
What it can and can't do
What the user does: You tap Fullscreen in a game, remote desktop or web editor.
It can
- Capture chosen shortcut keys so a game or remote desktop receives them
- Release them when you leave fullscreen
It cannot
- Start without a click, tap or keypress
- Block system shortcuts the computer keeps for itself
- Stop you leaving fullscreen, since holding Esc for about two seconds still exits
- Keep capturing after you leave fullscreen
How it differs between platforms: Chrome and Edge on computers only. Firefox and Safari do not support it.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 68 | 2018-07-24 | None |
| Edge | Supported | 79 | 2020-01-15 | None |
| Firefox | Not supported | Not available | Not listed | None |
| Safari | Not supported | Not available | Not listed | None |
| Safari on iPhone | Not supported | Not available | Not listed | None |
| Chrome on Android | Supported | 68 | 2018-07-24 | None |
| Samsung Internet | Supported | 10.0 | 2019-08-22 | None |
How a site asks for it
| API | navigator.keyboard.lock(['Escape','KeyW']); navigator.keyboard.unlock() |
| Browser compat keys | api.Keyboard.lockapi.Keyboard.unlock |
| How access is granted | gesture |
| What the user sees | No prompt (needs a click, tap or keypress) |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | Yes |
| Activation | transient |
| How long it lasts | Ends on unlock(), leaving fullscreen or navigation; nothing is stored |
| How to take it back | Nothing to revoke (no permission is stored) |
| Inside an iframe | Needs the frame to be fullscreen, so cross-origin iframes need allow="fullscreen" |
Typical flow
- Person clicks
- Page enters fullscreen
- Page calls navigator.keyboard.lock() with a list of key codes
- Chosen keys go to the page instead of the browser
Data you get
Shape: none
No individual data fields. The signal is the access itself.
Technical limits
- Chrome and Edge only (no Firefox, no Safari, no iOS)
- Works only while the page is fullscreen in Chrome; locking Escape means the person must hold Esc for about 2 s to leave fullscreen
- Keys are named by physical KeyboardEvent.code values, not characters
- Some combinations stay with the OS or browser, such as Ctrl+Alt+Del and system shortcuts like the macOS app switcher
- Cannot lock keys while the tab is in the background
The story
What it is
Lets a full screen page capture shortcut keys like Esc, Alt+Tab or Ctrl+W (Chromium only).
For you
In full screen, keys like Esc and Alt+Tab may go to the page instead of your computer. A hint tells you to hold Esc to leave.
For makers
It makes cloud gaming and remote desktops feel like the real thing, because every key reaches the game or the far computer. Sites must be in full screen first.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A cloud gaming site sends every key to the game, including Windows and Esc, so menus and chat work. | Xbox Cloud Gaming, GeForce NOW |
| enterprise | A remote desktop in the browser passes Ctrl+W and Alt+Tab to the far computer instead of closing your tab. | Chrome Remote Desktop |
| games | A browser shooter keeps Esc for its own pause menu rather than letting the browser grab it. | None named |
| education | A coding class sandbox keeps shortcuts inside the editor so students do not close the tab by mistake. | None named |
| security | An exam site locks keys to block tab switching, which students and critics find invasive. | None named |
| creative | A music or video editor in full screen uses every key for its own shortcuts. | None named |
Risks
- Can block escape routes
- Chromium only
What the platform says
- MDN: Keyboard API. Explains how a page can lock keys such as Esc and system shortcuts while in full screen.
Good uses and abuse
Legitimate uses
- Remote desktop and VM consoles
- Browser games
- Cloud IDEs and terminals
Known abuse
- Trapping the person in a fullscreen spoof that eats Esc and Ctrl+W
- Hiding shortcut use from the person
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 3 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 1 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2018-07, Chrome 68: Keyboard Lock API ships on desktop
- 2020-01, Edge 79: Available in Chromium based Edge
Related capabilities
Related
- Fullscreen. Can make a video or page area fill your screen, after you tap
- Keyboard and IME events. Can see each key you press while the page has focus
Sources
How well checked: Based on official documentation.