RFR: 8323511 Scrollbar Click jumps inconsistent amount of pixels

Andy Goryachev angorya at openjdk.org
Fri Jan 12 23:47:30 UTC 2024


On Wed, 10 Jan 2024 12:31:20 GMT, Florian Kirmaier <fkirmaier at openjdk.org> wrote:

> As seen in the unit test of the PR, when we click on the area above/below the scrollbar the position jumps - but the jump is now not always consistent.
> In the current version on the last cell - the UI always jumps to the top. In the other cases, the assumed default cell height is used.
> 
> With this PR, always the default cell height is used, to determine how much is scrolled.
> This makes the behavior more consistent.
> 
> Especially from the unit-test, it's clear that with this PR the behavior is much more consistent.
> 
> This is also related to the following PR: https://github.com/openjdk/jfx/pull/1194

Tested on macOS 14.1.2 with ListView, fixed and variable cell height, using MonkeyTester 
https://github.com/andy-goryachev-oracle/MonkeyTest

I do see two problems:

1. With variable height cells: if I click below the scrollbar thumb, followed by a click above the thumb, I expect the view to go back to the same position exactly, but it does not (see the screenshots).  I think I've mentioned this problem before in some other PR.

initial condition:
![Screenshot 2024-01-12 at 15 39 13](https://github.com/openjdk/jfx/assets/107069028/33f9f494-5605-4297-9a9f-b38e1c67ba0c)

clicked below the thumb:
![Screenshot 2024-01-12 at 15 39 17](https://github.com/openjdk/jfx/assets/107069028/27f3bf28-1d2d-48b7-91e0-96e99dd82758)

clicked above the thumb:
![Screenshot 2024-01-12 at 15 39 22](https://github.com/openjdk/jfx/assets/107069028/149449bd-6b7b-49c2-b4cd-dc2e540856fb)


2. this one is more serious.  sometimes it gets into state when clicking below the thumb does not move the scroll bar at all, here is the screenshot:
![Screenshot 2024-01-12 at 15 38 44](https://github.com/openjdk/jfx/assets/107069028/672a1c8a-4239-481a-822e-f7e77c119867)

It seems to happen when the cell height exceeds the viewport height AND the cell is positioned exactly at the top of the viewport.

Can you see it?

modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java line 1548:

> 1546: 
> 1547:     // will return true if scroll is successful
> 1548: private boolean tryScrollOneCell(int targetIndex, boolean downOrRight) {

please revert indentation change

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1326#issuecomment-1890149894
PR Review Comment: https://git.openjdk.org/jfx/pull/1326#discussion_r1451024141


More information about the openjfx-dev mailing list