Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-260764

Right-clicking will focus text fields

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.19.4 Pre-release 4
    • 1.19.3, 1.19.4 Pre-release 3
    • None
    • Confirmed
    • UI
    • Low
    • Platform

      Unlike the majority of widgets within the user interface, text fields can be focused by right-clicking. In addition, right-clicking a text field then a button (or vice versa) will cause both widgets to be focused. One place this issue occurs is the structure block screen, similarly to MC-147605.

      Note that right-clicking a text field is different from left-clicking in that left-clicking moves the cursor in the text field. If right-clicking a text field is intentional, I would at least expect it to move the cursor or change the selection in some way.

      Relatedly, while there are no such cases to my knowledge in vanilla Minecraft where this would be an issue, please call (Yarn mappings) Element#mouseClicked for all elements in a EntryListWidget rather than short-circuiting. This is the same fix as what was done to ParentElement in MC-147605.

      Code analysis (Yarn mappings)

      Currently, the TextFieldWidget#setTextFieldFocused method does not check whether button == 0 for calling the TextFieldWidget#setTextFieldFocused method, while it does for calling the TextFieldWidget#setCursor method. A suggested fix would be to move the button == 0 check to encapsulate both calls.

            Fantastime [Mojang] Maxime Lebrot
            haykam haykam
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: