RFR: 8237453: [TabPane] Incorrect arrow key traversal through tabs after reordering
Ajit Ghaisas
aghaisas at openjdk.java.net
Fri Feb 7 05:24:10 UTC 2020
On Wed, 5 Feb 2020 11:07:39 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:
> Issue:
> Dragging a tab and dropping it back to it's original position causes an incorrect reordering of tabs. Incorrect order of tabs can be observed using arrow key traversal through tabs.
>
> Cause:
> Below mechanism of identifying if tab header is dragged and dropped at same position is not reliable.
> When a tab is selected for dragging, the tab's layout X is stored as `dragHeaderStartX`.
> When the tab is dropped, the tab's destination layout X is saved as `dragHeaderDestX`.
> These two values are used to decide if the reordering of tabs is needed.
> This is an unreliable mechanism in two cases,
>
> 1. When the `TabPane.TabClosingPolicy` is set to `TabPane.TabClosingPolicy.SELECTED_TAB`, the close button icon gets added only to the selected tab.
> Each time when the tab selection is changed, the header region needs a re-layout. When a non selected tab is chosen for dragging `dragHeaderStartX` and `dragHeaderDestX` will always differ.
>
> 2. Calculation of `dragHeaderDestX` involves floating point operation. So the computed `dragHeaderDestX` may sometimes vary by fraction than `dragHeaderStartX`.
>
> Fix:
> Use the index of tab header for identifying the tabs which are reordered.
> Save the index when reordering begins. `dragTabHeaderStartIndex`
> Save the index when tab is dropped. `dragTabHeaderIndex`
> If the index are same then reordering of tabs is NOT needed.
> If the index are NOT same then the tabs from `dragTabHeaderStartIndex` to `dragTabHeaderIndex` are reordered.
>
> Verification:
> This fix is specific to TabPane reordering. No other tests/behavior should be affected.
> Added a new system test.
Marked as reviewed by aghaisas (Reviewer).
-------------
PR: https://git.openjdk.java.net/jfx/pull/106
More information about the openjfx-dev
mailing list