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

JBR-4479 Add text caret tracking for macOS Accessibility Zoom #255

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

dmitrii-drobotov
Copy link
Member

Added a call to UAZoomChangeFocus function when a text component fires an ACCESSIBLE_CARET_PROPERTY changed event. InputMethodRequests.getTextLocation is used to get the caret location.

How it works in IDEA and SwingSet (video quality is not great due to GitHub limits):

Screen.Recording.2023-11-16.at.11.13.05.mov
Screen.Recording.2023-11-16.at.11.26.38.mov

Known issues and further plans

  • There are a few cases when zoom doesn't follow caret in the Editor component in IntelliJ: when deleting text, pasting text, adding/removing tab indentation, using page up/down keys, and there may be more. Some of it is caused by the lack of caret change event, which we can implement as follow-up work later, while for other cases, it doesn't seem to work anywhere (e.g. Safari, Chrome, TextEdit).
  • Caret tracking works by moving the mouse pointer to the middle of the screen, which can block a part of the text, especially if the pointer size is big. Other apps are actually hiding the pointer when typing or navigating the text, but IntelliJ only hides it when typing (https://youtrack.jetbrains.com/issue/IDEA-69397). We should consider additionally implementing hiding the cursor when moving the caret, not just on typing.
  • Ideally, the Zoom should follow all keyboard focus changes, not only the text caret (if it's enabled in Zoom settings), which can be implemented by using the same UAZoomChangeFocus function. I decided to work on this part later in a separate PR, as it seems to be a bigger effort, and the text caret tracking alone brings a lot of value for IDE users.

@OnePatchGuy OnePatchGuy self-assigned this Nov 16, 2023
@OnePatchGuy OnePatchGuy self-requested a review November 17, 2023 11:37
Copy link
Member

@OnePatchGuy OnePatchGuy left a comment

Choose a reason for hiding this comment

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

A very clear patch, thanks a lot!
There are a few little improvement suggestions. Also, could you please do the following?

  1. Now your work is about JBR-4479. not JBR-4478. See this. Could you please update the PR description and the commit(s) message(s) according to this change?
  2. (If you haven't done this) it'd be great if you take some extra effort and check how well the fix works in the following cases. I'm mostly worried about correctness of positioning.
    2.1. When the screen has non-default scaling settings (System Preferences -> Display -> Display Settings).
    2.2. When there are several screens.
    2.3. When there are several screens with different scaling settings.

I've checked all the cases on my environment, but I think it's worth checking on another one, just in case.

@dmitrii-drobotov dmitrii-drobotov changed the title JBR-4478 Add text caret tracking for macOS Accessibility Zoom JBR-4479 Add text caret tracking for macOS Accessibility Zoom Nov 21, 2023
@dmitrii-drobotov
Copy link
Member Author

dmitrii-drobotov commented Nov 21, 2023

@NikitkoCent I've tested these scenarios, and it worked well because we get a new caret location every time. If any scaling changes happened between caret updates, we're not going reuse the old position, but get a new one, which should be calculated according to the current scaling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants