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
Set sneak or sprint to toggle mode in Options > Controls
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)
Toggle sneak or sprint on by pressing that button
Open any GUI (chest, chat, inventory, etc). Observe sneaking is toggled off
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
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