Skip to content

Commit

Permalink
feat: Only focus text field if name is empty to prevent accidental ch…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
BlayTheNinth committed Dec 27, 2023
1 parent febc9ec commit bd3c377
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.Slot;
import org.lwjgl.glfw.GLFW;

import java.util.ArrayList;
Expand Down Expand Up @@ -60,7 +59,7 @@ public void init() {
textField.setValue(oldText);
textField.setEditable(menu.canEdit());
addRenderableWidget(textField);
if (menu.canEdit()) {
if (menu.canEdit() && oldText.isEmpty()) {
setInitialFocus(textField);
}

Expand Down

0 comments on commit bd3c377

Please sign in to comment.