Fix Mouse Cursor not locking to Game in Windows 11/10 If the mouse cursor is not locking ... To resolve the issue, download the latest version of the touchpad or mouse driver.
Natively it is not possible to do that in Windows 11/10, but you can use a free tool named Lock Cursor Tools to lock the mouse cursor movement to a particular part of the desktop screen.
Windows Latest reports that a bug in Windows 11 24H2 is causing the mouse cursor to disappear in text input fields.