Normally, when opening the inventory, the cursor resets to the center of the screen. However, if the cursor is currently on a screen which is not aligned with the screen the game is running on, the cursor will snap to the edge of the game screen instead.
This is especially bothersome if you use your second monitor to talk to friends or to search things on the internet, so when you open your inventory your mouse isn't where you want it to be.
From what i managed to understand, this occurs when the center of the game window, the location the mouse is trying to reset to, is placed above the top of the second monitor. this occurs in fullscreen and windowed, but if you move the window so that the center is below the top of the second monitor the reset functions correctly.
I attached three files showcasing the issue (do note that the cursor didn't display properly on the game, so i added red circles showcasing where it moved to). The last image is where the mouse should be going to.
edit: i added the 'scenario_error' image, which shows that the issue still occurs as long as the center of the game is above that line. the moment i move the game window a bit lower, the reset works properly
Please check if this is still an issue in 1.17.1 or later.