Skip to content

Vaadin TreeGrid can't scroll to top #2127

@probert94

Description

@probert94

Description

I display some items in a TreeGrid. The TreeGrid is part of a TabbedPane, which hides/shows the components based on the selected tab.
Now when I scroll down in the TreeGrid and then hide it by selecting another tab, sometimes when showing it again, the scrollbar gets out of sync and won't let me scroll up to the first item. It basically remembers the old scrollbar position, but shows new items on that position instead.
Scrolling down a little and back up again shows some more items, I need to repeat this process a few times to get to the start of the list.
The issue appears, when using the mouse wheel or dragging the scrollbar knob, using the scrollbar button lets me scroll to the first item instead.
Note, that duing all of this no network requests have been made, so it's not a problem related to the DataProvider.

After a while, I was able to reproduce the issue using a new vaadin starter.
Strange thing is, that the issue seems to be related to a Select placed in the content of another tab.

Expected outcome

The grid should remember the scrollbar position and let me scroll to the top.

Actual outcome

The grid remembers the scrollbar position, but shows wrong items there and therefore I can't scroll up to the first items.

Live Demo (optional)

Note, that the items in the screenshots are sorted alphabetically.

Grid, showing the first items:
image

Grid after scrolling down a bit:
image

Grid after switching tabs a few times (without changing the scroll position).
Scrollbar position is still the same, but the visible items are not the same anymore.
image

Grid after scrolling to the top again. Instead of showing the item starting with 02 it shows item starting with 2e:
image

After scrolling down a little and up again it shows a few more items:
image

Minimal reproducible example

https://github.com/Springrbua/tree-grid-bug

Steps to reproduce

  1. Start the app
  2. In the TreeGrid scroll down a little
  3. Click the "Open second tab" Button and switch back to the first tab again.
  4. Repeat step 3 until the visible items are not the same anymore (I usually had to switch to second tab 3 times).

Environment

  • Vaadin: tested with 20.0.3, 19.0.8 and 14.6.3
  • Windows 10

Browsers Affected

  • Chrome
  • Opera
  • Firefox
  • Edge

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions