JDK-8056915 : Focus lost in applet when browser window is minimized and restored
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u67
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2008,windows_7,windows_8
  • CPU: generic
  • Submitted: 2014-08-29
  • Updated: 2017-01-17
  • Resolved: 2015-02-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 JDK 9
7u85Fixed 8u60Fixed 9 b54Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
In a simple applet which contains only text field, the text field gains focus when the applet starts. If user minimizes the browser window and later restores it, the text field loses input focus. To continue typing, user has to click the text field. If the browser window is minimized and restored once again, the text field loses input focus.
Comments
Frame-test.zip archive contains two simple test cases: for AWT (Applet) and Swing (JApplet): FrameApplet and JFrameApplet correspondingly. Steps to reproduce: 1. Extract files from the archive. 2. Compile java classes: javac FrameApplet.java javac JFrameApplet.java 3. Deploy HTML files and .class files to a web server. 4. Open either FrameApplet.html or JFrameApplet.html in Internet Explorer. Test Case 1: 1. When the applet starts, it should have the input focus in the text field. 2. Type some characters to make sure the characters are inserted into the text field. 3. Minimize the browser window: click Minimize button on the IE window. 4. Restore the browser window: click IE button the taskbar. 5. The text field should have the focus. 6. Type some characters to make sure the characters are inserted into the text field. Notes: At step 1, rarely the text field does not have focus after the applet starts, in particular after a security warning or another dialog was shown during applet start. At step 5, rarely the cursor does not blink in the text field. At step 5, the text field does not have the focus without the fix applied. Test Case 2: 1. Move focus to another control in IE user interface: click the address bar or search field, or click empty area on the page so that the text field in the applet loses focus. 2. Click the text field to move the focus to it. 3. Type some characters to make sure the characters are inserted into the text field. 4. Minimize the browser window: click Minimize button on the IE window. 5. Restore the browser window: click IE button the taskbar. 6. The text field should have the focus. 7. Type some characters to make sure the characters are inserted into the text field. Note: At step 6, rarely the cursor does not blink in the text field. At step 6, the text field does not have the focus without the fix applied. Although these two test cases look very similar, both have to be verified because the different code paths are used to preserve the focus in the applet after browser window is minimized and restored.
10-02-2015

Firefox and other browsers use NPAPI for communicating with Java Plugin. NPAPI doesn't provide any methods to communicate focus requests to the browsers, thus this issue can't be fixed for Firefox and other browsers.
30-01-2015

Root cause: Applet requests focus without letting Internet Explorer know that it's the active component on the page. When IE window is restored, IE sets focus to the HTML content since it was the last focus owner in IE process. The fix: Set focus to the Java Plug-in Control Window which is ActiveX control host which runs in-process with the IE page. When plugin control receives focus, it synthesizes window activation for the Embedded Frame where the applet is executed, in another process, and thus controls in applet receive focus. When IE window is minimized and then restored, IE sets focus its latest focus owner: Java Plug-in Control Window which, in its turn, passes focus to the applet.
30-01-2015

Escalated bugs live in the 7-pool, hence this step.
19-09-2014