-
Bug
-
Resolution: Unresolved
-
None
-
23w04a, 23w06a, 23w07a, 1.19.4 Pre-release 2, 1.19.4 Release Candidate 1, 1.19.4, 23w12a, 23w13a, 23w14a, 23w16a, 1.20 Pre-release 1, 1.20 Pre-release 4, 1.20 Release Candidate 1, 1.20, 1.20.1, 1.20.2, 1.20.4, 23w51b, 24w05b, 24w09a, 24w10a, 24w14a, 24w20a, 1.21 Pre-Release 2, 1.21, 24w33a, 1.21.1, 1.21.4
-
None
-
Confirmed
-
UI
-
Normal
-
Platform
The Bug:
Buttons and sliders remain selected after clicking on them.
This issue did not occur in 1.19.3. It first appeared in 23w03a.
Steps to Reproduce:
- Navigate to your video settings.
- Click on the "Graphics" button and then move your mouse cursor away from it.
- Take note as to whether or not buttons and sliders remain selected after clicking on them.
Observed Behavior:
Buttons and sliders remain selected.
Expected Behavior:
Buttons and sliders would not remain selected, just like how they didn't in 1.19.3.
Code Analysis:
Code analysis by isXander can be found in the duplicate MC-261578:
@Override default public boolean mouseClicked(double mouseX, double mouseY, int button) { for (GuiEventListener guiEventListener : this.children()) { if (!guiEventListener.mouseClicked(mouseX, mouseY, button)) continue; this.setFocused(guiEventListener); if (button == 0) { this.setDragging(true); } return true; } return false; }
Here you can see this.setFocused(guiEventListener) is being invoked on every mouse click. Remember, both Screen and ObjectSelectionList.Entry both implement this interface.
This could be fixed with the following code:
@Override default public boolean mouseClicked(double mouseX, double mouseY, int button) { for (GuiEventListener child : this.children()) { if (child.mouseClicked(mouseX, mouseY, button)) { if (button == InputConstants.MOUSE_BUTTON_LEFT) this.setDragging(true); return true; } } return false; }
However, this would break dragging code as mouseDragged is only passed to the focused element. This could be solved by just iterating through the children like usual, as most mouseDragged implementation have a boolean to check if they are dragging anyway.
- causes
-
MC-259609 Tooltips from selected buttons and sliders don't disappear when expected
- Resolved
- is duplicated by
-
MC-260220 Buttons and sliders continue being highlighted after interacting with them
- Resolved
-
MC-260871 Buttons in the gui keep pulsed like if we used the tab
- Resolved
-
MC-261000 Button highlights stay highlighted on Create a new world menu
- Resolved
-
MC-261540 Buttons Are Remaining Highlighted
- Resolved
-
MC-261578 GUI elements stay focused after mouse click
- Resolved
-
MC-261675 White boarders on hover of buttons sometimes do not go away.
- Resolved
-
MC-261695 Buttons and sliders remain selected after clicking on them
- Resolved
-
MC-262653 Recipe button discoloration issue
- Resolved
-
MC-262820 Button white border doesn't disappear when clicked
- Resolved
-
MC-263172 Sliders and Recipe Book buttons remain selected after being pressed
- Resolved
-
MC-264400 The recipe book button does not display properly
- Resolved
-
MC-267821 Button stays highlighted when not hovering over it
- Resolved
-
MC-268969 The white boarder of the buttons won't disappear after clicks
- Resolved
-
MC-269248 Two GUI buttons can be highlighted at the same time
- Resolved
-
MC-274165 After interacting, UI buttons stay highlighted
- Resolved
-
MC-274485 Game Menu Buttons keep highlighted after I switch into a new menu
- Resolved
-
MC-275709 Pressed button in Options menu freeze after clicking them, and staying highlighted
- Resolved
-
MC-277676 Minecraft Widget "bug"
- Resolved
- relates to
-
MC-259265 Recipe book stays highlighted blue after clicking on it
- Open
-
MC-263233 Scrolled menu doesn't focus on button if you press enter on selected button
- Open
-
MC-260759 The navigation arrows for the written book remain highlighted after clicking
- Reopened
-
MC-259263 Some buttons, sliders and other UI elements won't lose focus after clicking menu's background
- Resolved