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.
- Make sure IDE is in internal mode
- Open “Settings | Keymap” and assign a shortcut to “Internal Actions | UI | Dump Focusable Component Hierarchy”
- Reproduce the problem
- Once the focus is lost, determine which component is focused:
- Invoke “Dump Focusable Component Hierarchy” with a shortcut
- Scroll down
- Press “Close and copy into the clipboard”
- Create a new issue in YouTrack
- 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):
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.
- Copy “logging.properties” file from any JDK 11 distribution (usually stored under “conf” folder).
- Modify “logging.properties”:
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.