Focus input automatically

This commit is contained in:
Arne Keller 2021-03-09 14:34:15 +01:00
parent a4224f4263
commit 5c49e03ba0

View File

@ -59,6 +59,7 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
infoIcon.addClickListener(event -> onInfoIconClick()); infoIcon.addClickListener(event -> onInfoIconClick());
inputField = new TextField(); inputField = new TextField();
inputField.getElement().setAttribute("autofocus", "");
inputField.setPlaceholder(getTranslation("root.inputFieldPlaceholder")); inputField.setPlaceholder(getTranslation("root.inputFieldPlaceholder"));
inputField.setId(INPUT_FIELD_ID); inputField.setId(INPUT_FIELD_ID);
inputField.setClearButtonVisible(true); inputField.setClearButtonVisible(true);