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
8291502: Mouse or touch presses on a non-focusable region don't clear the focusVisible flag of the current focus owner #852
Conversation
👋 Welcome back mstrauss! A progress list of the required criteria for merging this PR into |
Webrevs
|
This will need to be very well-tested to ensure that there are no regressions. As part of the review, we will evaluate whether it is a safe enough fix to go into 19. /reviewers 2 |
@kevinrushforth |
In addition to automated testing, I also manually tested this change by building and running SceneBuilder with it. The behavior of the feature after this PR is applied mostly resembles how Windows 10/11, Chrome, and Firefox handle visible focus indicators. There are some very minor differences, which can be addressed later (for example, clicking on scroll bars doesn't seem to count as a mouse interaction Windows/Chrome/Firefox, where it does in this iteration of the |
They do indeed.
Be that as it may, this sort of refactoring is discouraged, especially in the case of a fix you want to get in late in the release (we have 3 days left before the RDP2 deadline of JavaFX 19). This will cause extra time for the reviewers and could jeopardize getting it into the release. It would have been better to save this change for a future bug fix. |
I've reverted most of the changes around |
Thank you. That will make this much easier to review. |
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 looks good, with a possible follow-up item to clarify the docs. I think it would be worth updating the spec to say that focusVisible
is cleared on a MOUSE_PRESSED
or TOUCH_PRESSED
event (in addition to the other events that can clear it). I recommend doing this in a follow-up bug, so it doesn't derail getting this bug fix in.
Since this would be a doc-only change, it could be done during RDP2 of JavaFX 19 (or even deferred to JavaFX 20, but it seems best to shoot for 19). Either way, it will need a CSR.
As a possible additional follow-on bug for the original feature, in a future release, is that navigating using the Windows Narrator's focus traversal keys doesn't set |
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 to me.
I have identified potential cleanup that may be required. It can be done as part of JDK-8253769
@@ -60,6 +60,9 @@ public final class MouseEventFirer { | |||
public MouseEventFirer(EventTarget target) { | |||
this.target = target; | |||
|
|||
// Use the alternative creation path for MouseEvent by default, see JDK-8253769 |
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.
If the alternative path is made the default then this class needs some cleanup. That can be done as part of JDK-8253769
. Request you to add a comment in JBS on JDK-8253769
to clean up the unused portion of MouseEventFirer.java
@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 1 new commit pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/integrate |
The
focusVisible
flag is only set on a node when it acquires input focus using a keyboard interaction, and it is cleared by mouse and touch interactions.It is not necessary for a node to lose input focus in order to lose
focusVisible
. Currently, clicking on a region of the scene that does not contain a focusable node does not clear thefocusVisible
flag.Detecting clicks or touches that should clear
focusVisible
can be achieved by adding an event filter forMOUSE_PRESSED
andTOUCH_PRESSED
to theScene
.There is an additional noteworthy change with this PR:
Adding event filters to
Scene
causes many tests to fail due to a bug inMouseEventFirer
that was identified in 8253769. Previously, mouse events generated byMouseEventFirer
skipped a code path that causes test failures due to incorrect coordinates. With the added event filters, the code path for mouse events is slightly different, exposing the incorrect coordinates and causing tests to fail.This problem can be solved by making the "alternative"
MouseEvent
generation path the default path.Note: Since this is a follow-up fix for 8268225, I'm targeting this fix for
jfx19
.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx pull/852/head:pull/852
$ git checkout pull/852
Update a local copy of the PR:
$ git checkout pull/852
$ git pull https://git.openjdk.org/jfx pull/852/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 852
View PR using the GUI difftool:
$ git pr show -t 852
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/852.diff