If you clicked to join a world the mouse will be considered to be “pressed down” until you click the mouse again.
Steps to reproduce:
Create a new world with commands enabled
Run
/advancement grant @s everythingLeave the world
Rejoin the world by either double clicking or clicking the play button
Press
L(advancements keybind)Move your mouse around
Observe that the advancements screen scrolls around as if you are clicking.
The expected behaviour is that mouse dragging should only happen if the mouse is actively being clicked down.
Code analysis:
This seems to be because during a world load the SDL mouse events are being dropped.
I believe the sequence of events is as follows:
Clicking on open world will first trigger MouseHandler#onButton setting MouseHandler#activeButton to some non-null value. It will then flow into Screen#mouseClicked which eventually calls Minecraft#doWorldLoad.
// Minecraft#doWorldLoad
// ...
while (!this.singleplayerServer.isReady() || this.gui.overlay() != null) {
// ...
RenderSystem.pumpEvents(this.sdlEventHandler);
// ...
}
// ...RenderSystem#pumpEvents is continuously called here, which calls SDL_EVENTS.SDL_FlushEvents(768, 4871) which will delete any mouse release events (1026) in the queue. So if you released your mouse after Minecraft#doWorldLoad is called it’ll get dropped while the world is loading.
Normally the release mouse event sets MouseHandler#activeButton back to null, but since it gets dropped the active button is never cleared. Then in MouseHandler#handlerAccumulatedMovement the if (this.activeButton != null && ...) check passes and Scree#mouseDragged is called even though there is no mouse button being actively pressed.
Can confirm. I do not know if anything besides the advancements screen would be affected by this; switching to survival, running
/item replace entity @s player.cursor with minecraft:stick 64and then opening your inventory and moving your cursor around does start splitting the stack, nor does targeting a block begin breaking it.