Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8237453: [TabPane] Incorrect arrow key traversal through tabs after reordering #106

Closed
wants to merge 1 commit into from

Conversation

arapte
Copy link
Member

@arapte arapte commented Feb 5, 2020

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.

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

JDK-8237453: [TabPane] Incorrect arrow key traversal through tabs after reordering

Approvers

  • Kevin Rushforth (kcr - Reviewer)
  • Ajit Ghaisas (aghaisas - Reviewer)

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 5, 2020

👋 Welcome back arapte! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request.

@openjdk openjdk bot added the rfr Ready for review label Feb 5, 2020
@mlbridge
Copy link

mlbridge bot commented Feb 5, 2020

Webrevs

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@openjdk
Copy link

openjdk bot commented Feb 5, 2020

@arapte This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type /integrate in a new comment to proceed. After integration, the commit message will be:

8237453: [TabPane] Incorrect arrow key traversal through tabs after reordering

Reviewed-by: kcr, aghaisas
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /solves command.

Since the source branch of this PR was last updated there have been 7 commits pushed to the master branch. Since there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate e224e549dd948ef93fda10bf5effcfb255d6c5fe.

➡️ To integrate this PR with the above commit message, type /integrate in a new comment.

@openjdk openjdk bot added the ready Ready to be integrated label Feb 5, 2020
@kevinrushforth
Copy link
Member

/reviewers 2

@openjdk
Copy link

openjdk bot commented Feb 5, 2020

@kevinrushforth
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

@kevinrushforth
Copy link
Member

kevinrushforth commented Feb 5, 2020

I'd like @aghaisas to take a look as well.

@openjdk openjdk bot removed the ready Ready to be integrated label Feb 5, 2020
@openjdk openjdk bot added the ready Ready to be integrated label Feb 7, 2020
@arapte
Copy link
Member Author

arapte commented Feb 7, 2020

/integrate

@openjdk openjdk bot closed this Feb 7, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Ready to be integrated labels Feb 7, 2020
@openjdk
Copy link

openjdk bot commented Feb 7, 2020

@arapte The following commits have been pushed to master since your change was applied:

  • e224e54: 8238526: Cherry pick GTK WebKit 2.26.3 changes
  • 6968e38: 8237469: Inherited styles don't update when node is moved
  • 3c55a7e: Merge
  • a4b9f24: 8237503: Update copyright header for files modified in 2020
  • 1749e85: 8237975: Non-embedded Animations do not play backwards after being paused
  • 2ab40c1: 8231513: JavaFX cause Keystroke Receiving prompt on MacOS 10.15 (Catalina)
  • aa91ebb: 8237944: webview native cl "-m32" unknown option for windows 32-bit build

Your commit was automatically rebased without conflicts.

Pushed as commit 21d3b7e.

@openjdk openjdk bot removed the rfr Ready for review label Feb 7, 2020
@mlbridge
Copy link

mlbridge bot commented Feb 7, 2020

Mailing list message from Ambarish Rapte on openjfx-dev:

Changeset: 21d3b7e
Author: Ambarish Rapte <arapte at openjdk.org>
Date: 2020-02-07 05:59:01 +0000
URL: https://git.openjdk.java.net/jfx/commit/21d3b7e0

8237453: [TabPane] Incorrect arrow key traversal through tabs after reordering

Reviewed-by: kcr, aghaisas

! modules/javafx.controls/src/main/java/javafx/scene/control/skin/TabPaneSkin.java
+ tests/system/src/test/java/test/robot/javafx/scene/TabPaneReorderTest.java

@arapte arapte deleted the TabPaneHeaderOrder_JDK_8237453 branch February 7, 2020 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
3 participants