OpenTTD has historically locked the mouse cursor position when the viewport is being dragged. This feature works on many systems without problems. However, on some platforms (e.g. Emscripten), pointer locking is difficult to implement without drawbacks. In particular, interacting with the Emscripten port currently requires the pointer to be locked inside the browser window all the time, which prevents moving to other applications easily and swiftly.
I explored a workaround for Emscripten in #8654 but the solution there had its own problems.
In that PR, @TrueBrain noted that there is actually an option to allow dragging the viewport without locking the mouse position. It seems that this option was added in #6756 to solve precisely the kind of issue that the Emscripten port is currently having.
The simplest solution would therefore be to make the non-locking option the default - this would make the Emscripten port work intuitively out-of-box, while still retaining legacy behavior for those who find it important.