Mojira Archive
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: Click button when slider under plays click sound twice.mp4

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.

Mekal Covic in this comment

Fixed

TheBoy358

[Mojang] Maxime Lebrot

2019-03-13, 07:48 PM

2024-11-11, 09:16 AM

2022-10-10, 01:19 PM

87

24

Confirmed

Normal

Sound, UI

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

Minecraft 19w11a - 1.19.2Minecraft 19w11a, Minecraft 19w12b, Minecraft 19w13a, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14 Pre-Release 1, Minecraft 1.14 Pre-Release 2, Minecraft 1.14 Pre-Release 3, Minecraft 1.14 Pre-Release 4, Minecraft 1.14 Pre-Release 5, Minecraft 1.14, Minecraft 1.14.1 Pre-Release 1, Minecraft 1.14.1 Pre-Release 2, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 1, Minecraft 1.14.2 Pre-Release 2, Minecraft 1.14.2 Pre-Release 3, Minecraft 1.14.2 Pre-Release 4, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 1, Minecraft 1.14.3 Pre-Release 2, Minecraft 1.14.3, Minecraft 1.14.4 Pre-Release 1, Minecraft 1.14.4 Pre-Release 3, Minecraft 1.14.4 Pre-Release 4, Minecraft 1.14.4 Pre-Release 5, Minecraft 1.14.4 Pre-Release 6, 1.14.4, 19w34a, 19w35a, 19w36a, 19w37a, 19w38b, 19w38a, 19w39a, 19w40a, 19w41a, 19w42a, 19w44a, 19w45a, 19w45b, 19w46a, 19w46b, 1.15 Pre-release 1, 1.15 Pre-Release 2, 1.15 Pre-release 3, 1.15 Pre-release 4, 1.15 Pre-release 5, 1.15 Pre-release 6, 1.15 Pre-release 7, 1.15, 1.15.1, 1.15.1 Pre-release 1, 1.15.2 Pre-Release 1, 1.15.2 Pre-release 2, 1.15.2, 20w06a, 20w07a, 20w08a, 20w09a, 20w10a, 20w11a, 20w12a, 20w13a, 20w13b, 20w14a, 20w15a, 20w16a, 20w17a, 20w18a, 20w19a, 20w20a, 20w20b, 20w21a, 20w22a, 1.16 Pre-release 1, 1.16 Pre-release 2, 1.16 Pre-release 3, 1.16 Pre-release 5, 1.16 Pre-release 6, 1.16 Pre-release 7, 1.16 Pre-release 8, 1.16 Release Candidate 1, 1.16, 1.16.1, 20w27a, 20w28a, 20w30a, 1.16.2 Pre-release 1, 1.16.2 Release Candidate 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3 Release Candidate 1, 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, 20w45a, 20w46a, 20w48a, 20w49a, 20w51a, 21w03a, 1.16.5, 21w05a, 21w05b, 21w06a, 21w07a, 21w11a, 1.17 Pre-release 2, 1.17.1, 21w43a, 21w44a, 1.18 Pre-release 1, 1.18 Pre-release 2, 1.18 Release Candidate 1, 1.18.1, 22w03a, 22w05a, 1.18.2, 22w11a, 22w15a, 22w16b, 1.19 Pre-release 2, 1.19 Pre-release 4, 1.19, 1.19.1 Pre-release 1, 1.19.2

22w42a