Skip to content

fix(remote-desktop): resolve Firefox stuck right-click via mouse state reconciliation#1297

Merged
Krista House (kristahouse) merged 1 commit into
masterfrom
fix/firefox-stuck-right-click
May 22, 2026
Merged

fix(remote-desktop): resolve Firefox stuck right-click via mouse state reconciliation#1297
Krista House (kristahouse) merged 1 commit into
masterfrom
fix/firefox-stuck-right-click

Conversation

@kristahouse
Copy link
Copy Markdown
Contributor

@kristahouse Krista House (kristahouse) commented May 22, 2026

Summary

Fixed a Firefox-specific issue where right-clicking inside the remote desktop canvas could leave the server-side right mouse button state stuck as pressed.

Changes

Input cleanup

  • onmouseleave now releases all active inputs through mouseOut()
  • Added focusLost() handling for:
    • window blur
    • document visibilitychange
  • This ensures inputs are released when the user leaves the canvas, switches tabs, or the browser loses focus

Mouse state reconciliation
Updated mouseIn() to compare event.buttons against tracked server-side button state.
If the browser no longer reports a button as held, the service releases it server-side.

This covers:

  1. left button
  2. right button
  3. middle button

Releases are batched into a single applyInputs call.

Listener cleanup

  • Hoisted captureKeys so it can be properly removed
  • onDestroy now removes:
    • keydown
    • keyup
    • blur
    • visibilitychange

Tests
Added mouseInput.test.ts covering:

  • mouseOut
  • focusLost
  • mouseIn reconciliation
  • missing-session guards
  • release batching
  • no-op behavior when no release is required

@kristahouse Krista House (kristahouse) changed the title fix(remote-desktop): Firefox right click issue via mouse reconciliation fix(remote-desktop): resolve Firefox stuck right-click via mouse state reconciliation May 22, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a Firefox-specific “stuck right-click” behavior in the web remote desktop client by reconciling mouse button state when re-entering the canvas and releasing inputs when the page loses focus/visibility.

Changes:

  • Add mouse button reconciliation on mouseenter and introduce focusLost() input release in RemoteDesktopService.
  • Update the Svelte component to release inputs on window blur / tab hidden, and remove the prior mouseleave button-state call.
  • Add Vitest regression coverage for mouse enter/leave and focus-loss input release behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
web-client/iron-remote-desktop/src/services/remote-desktop.service.ts Reconciles event.buttons on mouse re-entry and adds focusLost() to release inputs.
web-client/iron-remote-desktop/src/services/mouseInput.test.ts Adds regression tests covering mouse-out, focus-lost, and mouse-in button reconciliation.
web-client/iron-remote-desktop/src/iron-remote-desktop.svelte Hooks blur/visibility events to release inputs and removes the prior mouseleave button-state call.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web-client/iron-remote-desktop/src/services/mouseInput.test.ts Outdated
@kristahouse Krista House (kristahouse) force-pushed the fix/firefox-stuck-right-click branch from 5d19c84 to 3395d5c Compare May 22, 2026 19:20
@kristahouse Krista House (kristahouse) marked this pull request as ready for review May 22, 2026 19:27
@kristahouse Krista House (kristahouse) merged commit c56ea16 into master May 22, 2026
20 of 21 checks passed
@kristahouse Krista House (kristahouse) deleted the fix/firefox-stuck-right-click branch May 22, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants