-
Notifications
You must be signed in to change notification settings - Fork 450
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
8300013: Node.focusWithin doesn't account for nested focused nodes #993
Conversation
👋 Welcome back mstrauss! A progress list of the required criteria for merging this PR into |
I think this should go into JavaFX 20. |
Webrevs
|
I agree. In the (very likely) case it doesn't get reviewed before the fork, I'll ask you to retarget it to the |
/reviewers 2 |
@kevinrushforth |
Hi @tcfurrer, thanks for making a comment in an OpenJDK project! All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user tcfurrer for the summary. If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.
Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks fine to me!
@kevinrushforth @arapte With RDP1 ending soon, would you be willing to review this fix? |
One of us will review it next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Approved for jfx20
.
I left a couple questions, one of which might warrant a follow-up issue depending on your answer.
void adjust(int change) { | ||
count += change; | ||
|
||
if (count == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This presumes that you never call this with change > 1
. You don't, so it seems fine.
set(true); | ||
} else if (count == 0) { | ||
set(false); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth adding a check for count < 0
and logging a warning (possibly treating it as if it were 0)? In theory, it shouldn't happen, but if it ever did, focusWithin
would be wrong after that. This could be done as a P4 follow-up for 21, unless you are certain that it cannot ever happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the one hand, this might make the code a little bit more robust, but on the other hand, it might hide a bug elsewhere. Surely count
should never be negative. I lean slightly towards not protecting code against bugs in this way, mostly because it might expose potential bugs sooner.
If we want to validate that this method is not called with an incorrect argument, maybe just throwing an exception would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created a ticket to investigate this: https://bugs.openjdk.org/browse/JDK-8301556
@mstr2 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 24 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit a4bc9d1.
Your commit was automatically rebased without conflicts. |
When a scene graph contains multiple nested focused nodes (this can happen with
TableView
and other controls), thefocusWithin
bits that are cleared when a focused node is de-focused must only be cleared when there is no other nested node in the scene graph that would also causefocusWithin
to be set.For example, consider a scene graph of nested nodes:
A -> B -> C -> D
When B and D are both focused, the scene graph looks like this:
A(
focusWithin
)-> B(
focused
,focusWithin
)-> C(
focusWithin
)-> D(
focused
,focusWithin
)When B is de-focused, the
focusWithin
flags must still be preserved because D remains focused.This PR fixes the issue by counting the number of times
focusWithin
has been "set", and only clears it when it has been "un-set" an equal number of times.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx pull/993/head:pull/993
$ git checkout pull/993
Update a local copy of the PR:
$ git checkout pull/993
$ git pull https://git.openjdk.org/jfx pull/993/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 993
View PR using the GUI difftool:
$ git pr show -t 993
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/993.diff