Reporting focus problems

This article describes how to report issues with focus in IntelliJ based IDEs. Please, follow the bullet points. Note that there's no need to provide JDK logs (next section) if you were not asked distinctly by JetBrains employee.

  1. Make sure IDE is in internal mode
  2. Open “Settings | Keymap” and assign a shortcut to “Internal Actions | UI | Dump Focusable Component Hierarchy”
  3. Reproduce the problem
  4. Once the focus is lost, determine which component is focused: 
    1. Invoke “Dump Focusable Component Hierarchy” with a shortcut
    2. Scroll down
    3. Press “Close and copy into the clipboard”
    4. Create a new issue in YouTrack
    5. Paste the info from the clipboard into the issue description

 

How to collect JDK logs (only if asked)

The aim is to determine what’s wrong with the focus events. An approach described below is based on comparing focus events between the two IDE builds - broken and working.

      1. Get the logging.properties file

      2. Specify the path to the downloaded file in the IDE “.vmoptions” file (Help | Edit Custom VM Options):

-Djava.util.logging.config.file=/Users/<username>/logging.properties

      3. Run the IDE from the console

The console should become flooded with focus events. Note that events are produced every time when focused component changes. In case you don’t see them, go to the section Setting up “logging.properties” below

      4. Recreate the problem. Every time a focus event appears, copy it to a text file

      5. Repeat steps 2-4 on IDE instance that isn’t affected by the issue (use some of the previous builds - see "Other Versions" section on IDE download page, or roll back if you use Toolbox)

      6. Compare focus events during normal and buggy scenarios. Likely you’ll notice that some events are missing when the bug happens - that’s the key that will help to fix it. See an example of an investigation

      7. Once finished, add tag focus-info-collected to the issue so the responsible developers can find and fix it

Setting up “logging.properties”

You should only follow this section if referred from the step 3 of the instruction above.

  1. Copy “logging.properties” file from any JDK 11 distribution (usually stored under “conf” folder).
  2. Modify “logging.properties”:
  • Set one of the handlers:
handlers= java.util.logging.ConsoleHandler

or

handlers= java.util.logging.FileHandler
  • Set logging level: 
java.util.logging.ConsoleHandler.level = ALL
  • Add component to the end (if needed, you can find other components in java.awt.Component - eventLog, focusLog, etc):
java.awt.focus.Component.level = ALL
sun.lwawt.focus.LWComponentPeer.level = ALL
java.awt.focus.DefaultKeyboardFocusManager.level = ALL

For reference, see this link.

Please sign in to leave a comment.

Have more questions?

Submit a request