No scroll to top on view change


how can I scroll to top on view change?
Every time if I navigate from a view to the next, I see the middle of view/page instead of top of view…

Unfortunately these code doesn’t work:

UI.getCurrent().getPage().executeJs("document.getElementById('VerticalLayout1').scrollTop = 0;");

Do you have an another idea ?

Thanks in advance

Hi Hakan,

There’s some information and tips here:


Thanks for your answer.

can you say me in which class I have to add these line:

addAttachListener(event -> UI.getCurrent().getPage().executeJs("document.documentElement.scrollTop = 0;")); ? Or my other views, which have the problem witch no scrolling on the top?

Can you give me more informations?

Thanks in advance.