Skip to content

macOS: Pointer lock request failed #8

@baberabb

Description

@baberabb

The app connects to the local linux server (copied server-components dir), but inputs fail to register. Seems to be a known issue.

Screenshots Image Image
Summary by claude

Description

Pointer lock requests fail with the error "Pointer lock requires the window to have focus" on macOS, even when the Tauri window appears to be focused and is the active window.

Environment

  • Tauri version: 2.x
  • Platform: macOS (Darwin)
  • Rust version: rustc 1.92.0 (ded5c06cf 2025-12-08)

Steps to Reproduce

  1. Create a Tauri app with a webview that requests pointer lock on click
  2. Run the app on macOS
  3. Click on an element that calls element.requestPointerLock()

Expected Behavior

Pointer lock should be granted when clicking on the element.

Actual Behavior

The pointer lock request fails with:

Pointer lock request failed: Pointer lock requires the window to have focus

Code Example

const requestPointerLock = () => {
  const result = containerRef.current?.requestPointerLock()
  if (result && typeof result.catch === 'function') {
    result.catch((err) => console.warn('Pointer lock request failed:', err.message))
  }
}

// Called on click handler - still fails
<div onClick={requestPointerLock}>Click to lock</div>

What I've Tried

  1. Removed transparent: true from window config - no effect
  2. Called getCurrentWindow().setFocus() before requesting pointer lock - no effect
  3. Added shadow: true to window config - no effect

Current window configuration:

{
  "windows": [{
    "decorations": false,
    "transparent": false,
    "shadow": true,
    "resizable": true
  }]
}

Additional Context

  • The click event fires correctly (it's a valid user gesture)
  • The window visually appears focused (title bar is active)
  • This may be related to how WKWebView handles focus state vs the native window focus
  • The issue may be specific to decorations: false windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions