The bug
When adding a new server entry ("Add Server" button) or editing an existing one ("Edit" button), the "Server Name" text field does not immediately have focus, though the cursor is blinking in it and pressing TAB ↹
switches to the "Server Address" field.
How to reproduce
Open the "Multiplayer" server list
Click "Add Server"
Try to type a server name
❌ The cursor is blinking in the "Server Name" text field, but you cannot type in it
Code analysis
Code analysis by @unknown in this comment.
Linked issues
is duplicated by 1
relates to 1
Attachments
Comments 14
Code analysis based on Minecraft 1.17 with yarn mappings.
In net.minecraft.client.gui.screen.AddServerScreen#init()
, the game makes the server name field focused:
this.serverNameField.setTextFieldFocused(true);
This is the wrong, since it only makes it appear focused. Instead, it should use the following at the end of init()
:
this.setInitialFocus(this.serverNameField);
Hmm, upon clicking on the text field, you can properly edit it. However, even before that the cursor is blinking, indicating that you should be able to write (which you can't).