Reporting focus problems
This article describes how to report issues with focus in IntelliJ based IDEs. Please, follow the bullet points when first reporting the issue:
- Provide the IDE About info and indicate whether the same issue appeared in previous version (in case you used it before and upgraded).
- List the exact steps that lead to the issue.
- Attach a screen recording demonstrating the problem.
In rare cases JetBrains employees might need additional details to identify the root cause. The following instructions are to be followed if and only you were distinctly asked to do so.
Detecting the focused component visually
- Make sure IDE is in internal mode
- Go to Tools | Internal actions | UI | Start focus debugger in the main menu
- Start screen recording
- Reproduce the problem
- Stop screen recording and disable focus debugger via Tools | Internal actions | UI | Stop focus debugger
- Share the screen recording with us
Detecting the focused component using the focus dump
- Make sure IDE is in internal mode
- Open “Settings | Keymap” and assign a shortcut to “Other | 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
- Press “Close and copy into the clipboard” button at the top of the appeared window
- Share the info from the clipboard with us
Collecting JDK logs
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
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”:
- 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.