Skip to content

UI Focus is not updated when clicking widgets in mainGroup #98

@remakefactory

Description

@remakefactory

Bug Description

When a UI contains a focusable element (e.g., a TextField) and widgets within the mainGroup (e.g., item slots), the focus management behaves incorrectly. If the focus is on the TextField, clicking a widget in mainGroup performs the action but does not transfer or clear the focus from the TextField.

Steps to Reproduce

  1. Open a GUI that has both a TextField and an item slot within the mainGroup.
  2. Click on the TextField to give it focus (a cursor should appear).
  3. Click on the item slot in the mainGroup.
  4. Try typing on the keyboard.

Expected Behavior
After clicking the item slot, the TextField should lose focus, and keyboard input should no longer be directed to it.

Actual Behavior
The item slot action is performed correctly, but the TextField remains focused. Keyboard input continues to be sent to the TextField.

Analysis
The issue lies in the main container's mouseClicked method. When modularUI.mainGroup.mouseClicked(...) returns true, the parent method returns immediately. This premature return bypasses the code block responsible for updating the focus with this.setFocused(...).

com.lowdragmc.lowdraglib.gui.modular.ModularUIGuiContainer#mouseClicked
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions