vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 729 forks source link

Vaadin 8, Window opened with undefined height gets scrolled to the top on each poll #11705

Open padisah opened 5 years ago

padisah commented 5 years ago

I have created a Window with width 100%, and height undefined. This Window has more content than fits to the monitor, so a vertical scrollbar appears as it should. When manually scrolling to the bottom, it automatically scrolls back to the top on each long poll.

Root cause: VWindow.java: @Override public void setHeight(String height) { // Override PopupPanel which sets the height to the contents getElement().getStyle().setProperty("height", height); // scrolls to top, even if height remains "" // Update v-has-height in case undefined window is resized setStyleName("v-has-height", height != null && !height.isEmpty()); }

AbstractComponentConnector.updateComponentSize() just calls for size update, without checking if there is any size change, and a side effect of scrolling happens.

Workaround: I set the window height to 100% instead of undefined, and it looks like solving the issue.

TatuLund commented 5 years ago

I think your report is duplicate of this issue: https://github.com/vaadin/framework/issues/6650

padisah commented 5 years ago

I can confirm, this is the same problem. But it wasn't fixed in Vaadin 8. Actually as I saw, the relevant codes that causes this are from Vaadin 7.

TatuLund commented 5 years ago

@padisah Do you have simplified test app that reproduces the problem? I tried to do couple of attempts, but I could not reproduce the issue with my test apps.

padisah commented 5 years ago

Ok, I will create a github repo to reproduce the issue.

padisah commented 5 years ago

https://github.com/padisah/vaadin8-scrollTop

here is the repo, that reproduces the issue simply mvn jetty:run works, I tried it

there were some efforts, that forces the long-polling, that should probably be replaced to a better way

padisah commented 5 years ago

Added a commit, which raises version to 8.8.6 and disables push, websocket, while leaves the polling in place.

TatuLund commented 5 years ago

Ah, now I see. I tried to reproduce the issue with @Push and LONG_POLLING transport mode, and there it does not happen. But if I indeed use polling UI instead of Push, then the issue is easy to reproduce.

stale[bot] commented 4 years ago

Hello there!

We are sorry that this issue hasn't progressed lately. We are prioritizing issues by severity and the number of customers we expect are experiencing this and haven't gotten around to fix this issue yet.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!