Can someone confirm if Firefox is incorrectly handling captured mouse movement?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By plasmid

I found that when I export my game to HTML5 and play in Firefox, if the player captures the mouse, then using func _input(event): and event.relative to detect mouse motion isn’t reliable and it sometimes (often) registers horizontal movement even when the mouse is still. It doesn’t give that strange effect in Firefox if the mouse is not captured, and it doesn’t do that in Chrome or Edge either when the mouse is captured or when it’s not captured, and it only does that in Firefox when the mouse is captured AND the browser zoom is exactly 100%. Changing the browser zoom to 90% or 110% corrects it, and I previously published a game that used mouse capture that was working fine in Firefox in late 2021 but is now showing that same behavior even though I haven’t done anything to the game so it’s very weird and makes me think it might be the result of a Firefox update messing things up instead of a Godot issue, or might just be something weird with my computer.

I made a minimal test build and uploaded to Newgrounds: Previewing Gamepad configuration JavaScript demo
so if anyone could let me know if you also see the same behavior - motion on the x-axis registering when the mouse is captured and not moving in Firefox at normal 100% zoom but not in other browsers or when the mouse is not captured - then I’ll report it as an issue on the Godot GitHub. Otherwise I’ll assume it’s just an issue with my own computer. The source code for the project is

extends Control

var latest_x
var latest_y
onready var label_node = get_node("Label")

func _physics_process(delta):
	label_node.text = "Mouse motion x: " + str(latest_x) + ", y: " + str(latest_y)
	latest_x = 0
	latest_y = 0

func _input(event):
	if event is InputEventMouseMotion:
		latest_x = event.relative.x
		latest_y = event.relative.y
	if event is InputEventMouseButton:
		if event.pressed and (event.button_index == BUTTON_LEFT):
		if event.pressed and (event.button_index == BUTTON_RIGHT):

Using Firefox 95.0.2-1 (64-bit) on Arch Linux, I cannot reproduce the bug.

skysphr | 2022-01-06 19:27

I am not seeing that effect; when I move the mouse it sometimes detect the movement. When the mouse is captured, and I don’t move the mouse, there doesn’t seem to be any input detected (as expected in the engine). I’m using FF 95.0.1 on Linux Mint, BTW.

Ertain | 2022-01-06 22:23

Sounds like it’s probably just an issue with my computer (using Firefox 95.0.2 64-bit on Windows)… thanks for pointing me in the right direction.

plasmid | 2022-01-07 02:19