Device Access

Keyboard Lock

Probing…

Keyboard Lock is a web platform capability in the Device Access category. Capture system keys (Esc, Alt-Tab) in fullscreen. Supported in Chromium 68+; not available in Firefox and Safari. Requires a secure context (HTTPS or localhost) and a user gesture such as a click or tap.

Secure contextUser gesture

Try it

Loading demo…

Code

await el.requestFullscreen()
await navigator.keyboard.lock(['Escape', 'Tab'])
// System shortcuts (Esc, Alt-Tab) now reach your keydown handler

document.addEventListener('keydown', (e) => console.log(e.code))

navigator.keyboard.unlock()
await document.exitFullscreen()

Browser support

Chromium
68
Firefox
No
Safari
No

Frequently asked questions

Which browsers support Keyboard Lock?

Supported in Chromium 68+; not available in Firefox and Safari.

Does Keyboard Lock require HTTPS?

Yes. Keyboard Lock needs a secure context, so it only works over HTTPS (or on localhost during development).

What is Keyboard Lock used for?

Capture system keys (Esc, Alt-Tab) in fullscreen.

Can I try Keyboard Lock in my browser?

Yes. shwcs.net runs a live Keyboard Lock demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.

MDN reference ↗ Specification ↗