Skip to content

fix(web): improve mouse input reliability - #140

Merged
916BGAI merged 1 commit into
sipeed:mainfrom
lc6464:fix/mouse-input-reliability
Sep 11, 2026
Merged

916BGAI merged 1 commit into
sipeed:mainfrom
lc6464:fix/mouse-input-reliability

Conversation

@lc6464

@lc6464 lc6464 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR improves remote mouse reliability across connection changes, input-mode transitions, and browser lifecycle events.

Mouse button state is now released consistently when the WebSocket disconnects, the page loses focus or visibility, pointer lock ends, touch input is interrupted, or the user switches mouse modes. Failed release reports are retained and replayed after reconnection so that a transient connection loss does not leave a button pressed on the target host.

The change also tightens absolute-coordinate handling at display boundaries and removes an unnecessary reconnect when changing mouse modes.

Changes

  • Centralize mouse-button release handling for absolute and relative input.
  • Track pending releases when a neutral HID report cannot be sent, then flush both mouse interfaces after reconnection.
  • Release held buttons on blur, visibility changes, pointer-lock loss, touch cancellation, unmount, and mouse-mode transitions.
  • Keep release handling isolated from stale component state during asynchronous lifecycle events.
  • Clamp and normalize absolute coordinates at the valid HID report boundaries.
  • Avoid reconnecting the WebSocket solely because the selected mouse mode changes.
  • Preserve browser Back and Forward mouse buttons in both input modes.

Verification

  • pnpm install --frozen-lockfile
  • pnpm run build
  • git diff --check

Manual Testing

Test topology: Microsoft Edge on an Android tablet as the Web client, with a Windows PC as the controlled host.

  • Absolute-mode movement, clicking, dragging, and positioning at all screen edges and corners work correctly.
  • Relative-mode movement, clicking, dragging, and scrolling work correctly with a physical mouse connected to the Android tablet.

@lc6464
lc6464 marked this pull request as ready for review August 19, 2026 07:16
@916BGAI
916BGAI merged commit 3b013bb into sipeed:main Sep 11, 2026
@lc6464
lc6464 deleted the fix/mouse-input-reliability branch September 11, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants