-
Notifications
You must be signed in to change notification settings - Fork 487
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
8291087: Wrong position of focus of screen reader on Windows with screen scale > 1 #853
Conversation
/reviewers 2 |
👋 Welcome back kcr! A progress list of the required criteria for merging this PR into |
@kevinrushforth |
Webrevs
|
just curious, does it work when the control spans two monitors with different scales? |
I did some limited testing yesterday with two screens each of which had a different scale, and what I tested works as expected. |
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 tested this on Windows with 100%, 125%. 150% and 175% scales. I confirm that this fixes the focus rendering problem seen with the screen reader being ON.
modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinAccessible.java
Show resolved
Hide resolved
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.
LGTM, Tested with different scale factors on one screen only.
@kevinrushforth 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 11 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 |
I filed JDK-8291590 to track this. |
I did a little more multi-screen testing with different layouts, and saw some odd behavior on the secondary screen that I want to track down and understand better. It look like a different problem, but I want to be sure before I integrate this. If it is a different problem, I'll file another follow-on bug. |
Getting back to this, I discovered what the problem was with some multi-screens layouts when two screens have a different scale. Computing the platform x and y by simply multiplying by the scale is not right, and only work for a screen that touches the origin of the virtual screen space (in both X and Y). When the secondary screen is to the left or above the primary screen, the simple (but incorrect) calculation gives the same result as the correct calculation. For a secondary screen below or to the right of the primary screen, it doesn't. Simply scaling the coordinate about the origin produces a value that is either too small or too large when the two screens have a different scale. The right fix is to use the I've tested this updated version in various combinations of layout and screen scales, and everything now works as expected. |
@kevinrushforth : |
Much of my testing was done with a window straddling two screens. It works as expected in all cases I checked. If a single control spans both screens, the part that is on each screen is correctly highlighted by the Windows Narrator visible focus. Note that in this mode, the window is considered to be "on" one of the screens, and all scales are relative to that screen (not just for accessibility, this is how HiDPI works on Windows if you are multi-monitor HiDPI aware). |
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 good!
/integrate |
Going to push as commit 38324a7.
Your commit was automatically rebased without conflicts. |
@kevinrushforth Pushed as commit 38324a7. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
When using the Windows Narrator screen reader on a Hi-DPI screen, the visible focus is drawn in the wrong location and with the wrong size. This happens because the the JavaFX Windows accessibility code that returns the screen bounds of the requested UI element does not take the screen scale into account.
The fix is to adjust the bounds by the screen scale before returning it.
You can test it on a Windows machine with scaling set to >= 125% as follows:
hello.HelloTextField
inapps/toys/Hello
Without the fix, Narrator shows the focus indicator in the wrong position and is too small. With the fix, it is correct. While testing this, I discovered an unrelated (and preexisting) bug where the focus indicator for a TextField or TextArea whose content is larger that the control (and is displayed with scroll bars) is not clipped to the visible area. This happens regardless of screen scale. I will file a follow-up bug for this.
Note that this bug is specific to Windows. It does not occur on macOS, which works correctly on a retina or non-retina display.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx pull/853/head:pull/853
$ git checkout pull/853
Update a local copy of the PR:
$ git checkout pull/853
$ git pull https://git.openjdk.org/jfx pull/853/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 853
View PR using the GUI difftool:
$ git pr show -t 853
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/853.diff