vaadin / vaadin/framework

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

Open
#11,705 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Stale
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

  • Vaadin Framework version: 8.8.5
  • Browser version:
    Chromium Version 76.0.3809.100 (Official Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit) (also reproduced with Firefox)
  • Web container name and version: Tomcat 9.0
  • Description of the bug:

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.

  • Expected behavior: There should be no inadverted scrolling.

  • Actual behavior: Inadverted scroll.

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with VWindow.java#setHeight and AbstractComponentConnector.updateComponentSize(), following the issue's description of the size-update path. Reproduce the undefined-height Window case while scrolling, then verify that polling no longer moves the viewport to the top without changing the intended Window sizing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.