mojira.dev
MC-308595

The toggled sneaking/sprinting state is not restored after closing a GUI when bound to a mouse button

Description

When Sneak or Sprint is set to toggle mode in the controls, the game forces the toggle off when a GUI (inventory, chat, container, etc) is opened. For keyboard keys, the previous toggle state is correctly restored when the GUI is closed. However, if the sneak or sprint key is bound to a mouse button (eg: mouse button 4 in a gaming mouse), the toggle is not restored and the player must manually resume sprinting/sneaking

Steps to reproduce

  1. Set sneak or sprint to toggle mode in Options > Controls

  2. Bind sneak or sprint to a mouse button (eg: a side mouse button if present, or just normal left/right mouse button. Temporarily unbind attack / place if needed to avoid conflicts)

  3. Toggle sneak or sprint on by pressing that button

  4. Open any GUI (chest, chat, inventory, etc). Observe sneaking is toggled off

  5. Close the GUI. Observe sneaking is not toggled back on

Expected result

The previous sneak/sprint state is restored, and the player resumes sneaking/sprinting

Actual result

The player remains not sneaking/not sprinting.

This works correctly if the button is bound to a keyboard button (eg: Shift), but not when it is bound to a mouse button (eg: button 4, LMB)

Environment

macOS 15.7.3, Java 25

Comments 1

Can confirm. This happens back in 1.21.9 and the bugged behavior persists in the released version of 26.2.

Environment

macOS 26.5.1, Java 25

AdyTech99

(Unassigned)

Confirmed

Platform HC

Normal

Input

26.2 Pre-Release 3

Retrieved