the Chromium logo

The Chromium Projects

Mouse Lock (Pointer Lock)

This document describes implementation details of the Pointer Lock JavaScript specification (In Chrome code it is referred to as Mouse Lock), the Pepper/NaCl MouseLock, and the shared user interface Full Screen Bubble UI .

What is Pointer Lock? From the specification:

The Pointer Lock API provides for input methods of applications based on the movement of the mouse, not just the absolute position of a cursor. A popular example is that of first person movement controls in three dimensional graphics applications such as games. Movement of the mouse is interpreted for rotation of the view-port, there is no limit to how far movement can go, and no mouse cursor is displayed.

Pointer Lock is related to Mouse Capture [MDN-SETCAPTURE]. Capture provides continued event delivery to a target element while a mouse is being dragged, but ceases when the mouse button is released. Pointer Lock differs by being persistent, not limited by screen boundaries, sending events regardless of mouse button state, hiding the cursor, and not releasing until an API call or specific release gesture by the user.


Chrome 16 introduced Mouse Lock only in full screen mode:

Chrome 21 added support for Mouse Lock without the full screen prerequisite:

Also, when an application exits (i.e. not due to the user pressing ESC, etc.) and reenters mouse lock there is no user gesture required and no exit instructions are shown. This provides for an improved user experience when an application frequently shifts in and out of mouse lock, such as a game with first person controls but a cursor used for inventory management.

Chrome 22 shipped Pointer Lock (the JavaScript API) default on.

Chrome 23 enables Pointer Lock via sandboxed iframes.


Content Settings Preferences Page Strings:

Mouse Cursor

(_) Allow all sites to disable the mouse cursor

(o) Ask me when a site tries to disable the mouse cursor (recommended)

(_) Do not allow any site to disable the mouse cursor

[Manage Exceptions...]

Mouse Cursor Exceptions

State transitions for the initial Chrome 16 launch were enumerated in this spreadsheet, which is now out of date with the addition of extension triggered full screen and non fullscreen permission of mouse lock.

Tests are in:

Related open issues: Feature=Input-MouseLock