Skip to content

Commit

Permalink
fix: Properly remove focus from the last focused widget
Browse files Browse the repository at this point in the history
The previous implementation did not remove focus from the last focused
widget when another widget was focused. This caused visual inconsistencies,  such as the caret in the search bar persisting even after focus was stolen by another widget. Updated `AbstractFrame::setFocused` to ensure the focus state of the previous widget is cleared correctly.

Fixes #123
  • Loading branch information
LitnhJacuzzi authored and FlashyReese committed Jan 16, 2025
1 parent 37f3c43 commit aec3045
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public GuiEventListener getFocused() {

@Override
public void setFocused(@Nullable GuiEventListener focused) {
if (this.focused != null) {
this.focused.setFocused(false);
}
this.focused = focused;
if (this.focusListener != null) {
this.focusListener.accept(focused);
Expand Down

0 comments on commit aec3045

Please sign in to comment.