Hello,
I created a class extended the AppLoginWindow and I want at the start of the app to put the focus directly to the login field. I tried to use the tabIndex property without success
Any clue?
Thanks
Hello,
AppLoginWindow
is already focusing on the login field:
@Override
public void init(Map<String, Object> params) {
super.init(params);
loginField.requestFocus();
...
}
Screenshot login form with focus
Which version of CUBA do you use? Maybe you override init()
method?
Hello,
I’m using the 7.2.4 version ,
I tried the code below since requestFocus is deprecated
But I sill have no focus on the login field, i got the focus after logout
@Override
public void init(Map<String, Object> params) {
super.init(params);
loginField.focus();
}
Hi Jean Marc,
the problem is, that the init-method is invoked to early in the lifecycle so that the focus is overriden elsewhere.
My solution:
@Subscribe
public void onAfterShow(AfterShowEvent event) {
loginForm.focusFirstComponent();
}
or
@Subscribe
public void onAfterShow(AfterShowEvent event) {
loginField.focus();
}
Hope this is helpful.
Cheers
Nico
Thanks Nico, but I still have the same problem. I tried to copy the code from sample projet of custom-login-window, and same thing. When the app starts I get this message
=================================================================
The widgetset in use does not seem to be built for the Vaadin
version in use. This might cause strange problems - a
recompile/deploy is strongly recommended.
** Vaadin version: 8.9.2-6-cuba**
** Widgetset version: 8.9.2-3-cuba**
=================================================================
**I’m wondering if it’s related. **
Thanks