The mouse capturing on the web is a bit tricky in first person games, I had a similar problem in a past game jam and it took a few iterations to get it right 😊
It's my second time making a first person game for the web (and for a Kenney Jam) using Godot, and still have the same issues XD