mojira.dev
MC-145748

Clicking a settings button when there's a slider under the mouse in the next screen plays the click sound twice

The bug

Clicking a settings button when there's a slider under the mouse in the next screen plays the "click" sound twice.

Example

Here is an example in video:

[media]

Additional note

This effect is also created when you push the mouse button down, hearing a click and entering a menu, move the mouse to be on top of a slider, and then releasing. You still get an extra click.

A nice place to demonstrate this is from the Minecraft title screen: move the mouse over the Options button, press down on Left Click, continue to hold down the button while moving the mouse up to the FOV slider, then release. Extra click sound.

Also, strangely, moving the mouse to be over a slider does not produce the extra sound when entering the Video Settings menu, but does work in Options, Music & Sounds, Controls, Chat Settings, and Accessibility Settings.

Code analysis

I'm a minecraft modder, and I accidentally found the source of this bug while making a custom GUI.
The problem is, as Joey mentioned above, because minecraft is coded to play the click sound for sliders on mouse release (see: AbstractSliderButton.java, method onRelease). Because the GUI changes on the mouse press, not release, the GUI elements have changed by the time you are releasing the mouse, resulting in the repeat of the sound. This can be resolved by adding some checks around the playDownSound call to make sure you've actually been manipulating the slider.

– @unknown in this comment

Linked issues

MC-239663 Double sound when clicking on music & sounds Resolved MC-207551 Music and sounds Resolved MC-204225 When selecting "music & sounds" in options, the "click" noise plays twice Resolved MC-190004 Double sound when clicked on "Chat Settings" Resolved MC-189215 Button click event sound plays twice when you click “Music & Sounds…” Resolved

Attachments

Comments 30

This seems to affect all sliders except those in the "Video Settings" menu.

Can confirm this bug!

[media]

Still in 1.14 Release

Still in 1.14.1 Release

Still in 1.14.2 Pre-Release 2

20 more comments

Can confirm for 22w05a

Can confirm in 1.18.2.

Still in 1.19-pre4

Can confirm in 1.19.

Can confirm in 1.19.2.

TheBoy358

Fantastime

Confirmed

Normal

Sound, UI

button, click, clickEvent, cursor, gui, gui-slider, menu, mouse, music, screen, slider, sound, sounds, ui

Minecraft 19w11a, Minecraft 19w12b, Minecraft 19w13a, Minecraft 19w13b, Minecraft 19w14a, ..., 1.19 Pre-release 2, 1.19 Pre-release 4, 1.19, 1.19.1 Pre-release 1, 1.19.2

22w42a

Retrieved