Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Focus and panel - how to
I've a panel with scrollbars with many textfields in it.
I need to set the focus on a given field and I use .focus().
Everythig is OK when the field is in the visible part of the panel but if I try to do the same operation when the field is not in the visible part of the panel nothing evident happens.
I believe the focus is set in the correct field but I hoped the focused field would be shown and it didn't happen.
Could someone suggest a workaround ?
Tks
Hi,
try calling com.vaadin.ui.UI.scrollIntoView(Component) with the target textfield as the parameter.
-tepi
It doesn't seem to work.
It still shows the page from the beginning.
I used
UI.getCurrent().scrollIntoView(myComponent);
The component is a checkbox in this case.
Tks
To be more precise myComponent is a layout containing a checkbox.
Tks