How to retain focus to a textfield, even after page refresh

Hello all,

I am relatively new to vaadin, I have a login page with username and password, where focus is set on the username field for the first UI load, but after page refresh the focus is lost.

Is there a way to retain the focus on the same username field even after page reload/refresh?

Thanks in advance
Dinesh

Hi!
If you call
username.focus()
during the initialization of the UI, it should get focused. But I guess that’s not the case.

Can you show some code how your login page/view/UI gets initialized?