Skip to content

JetBrains: Fix Linux focus issues

Warren Gifford requested to merge ps/jetbrains-fix-focus-issues into main

Created by: philipp-spiess

Closes #38276 (closed)

When playing around with this issue, we noticed a few things:

  • This was happening sporadically, so it seemed to be a race condition
  • You can recover from it by moving the focus to a different window and back to the SG window

That led me to believe that this has something to do with how we manually transfer the focus to the web view. To my surprise, removing this line would still lead to the behavior we want to an all platforms and also fix the bug on Linux.

Here's what we think went wrong:

  • The manual focus change was likely always broken but the issue was masked by the fact that the autofocus inside the web view was already working as expected.
  • On Windows and macOS, it seems that the web view will always run events after the Java thread finishes. Which means that the autofocus inside the web view will properly focus the right thing, making the manual focus management unnecessary.
  • On Linux, however, there seems to be a race between the Java manual focus management and whatever the web view does under the hood. If the Java one runs after the web view, it will cause this broken state.

Test plan

  • A lot of manual tests where we press esc alt+a asdf on repeat. It's not worth sharing a video of that but we tested on: Windows, Ubuntu Linux, and macOS.
  • We've also sent a preview to the customer that reported the issue, the'll test it in the next hour or so.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading