JDK-6426928 : focus lost within text item after applet is shown again
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 1.4.2_11
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2006-05-17
  • Updated: 2011-02-16
  • Resolved: 2006-06-26
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.
Other
1.4.2_13 b01Fixed
Description
test case attached.

Steps to run the tescase
-------------------------
1. Extract the contents of the zip file to a directory.
2. Load the file indusfocus.html on IE.
3. You will see a page with an applet loaded with a text item. The focus is in the text item.
4. Now click on the link called "Views". The applet is hidden.
5. Then click on the link called "BannerForms". The applet is shown.

On JDK 1.5, you will see that the focus remains inside the text item when the applet is shown again after step 5.
On JDK 1.4, you will see that the focus is not present in the text item after the applet is shown again after step 5.

Basically, the fix (for 1.5 but doesn't work in 1.4.2) for the bug is this :
1. The forms applet should be given a name i.e. in basejpi.html, the tag ID=<some_name> should be added to the <OBJECT> tag.
2. In the javascript function changebannerforms() present in indusfocus.html, the lines

           if (oFormsFrame != null) {
                    oFormsFrame.height = 600;
           }

must be changed to

           if (oFormsFrame != null) {
                    oFormsFrame.height = 600;
                    top.bannerforms.formsapplet.focus();
           }

Comments
EVALUATION On further investigation it's seen that the embeddedframe doesn't receive a window gained focus event when the applet is shown the second time (by clicking on the bannerforms url). Note that there are two independent events taking place when an embeddedframe is activated. Awt posts a WINDOW_ACTIVATE followed by a WINDOW_GAINED_FOCUS event and at the same time the OnSetFocus on the appletviewer/applet activates the embedded frame. These are two asynchronous events which could have a tussle with each other thereby messing up one of these events. In 5.0, this has been taken care of properly by synthesizing the window activation events. Thus it looks like we need to backport the fix for 4922092. This is a considerable change on both java and native level and has to be done carefully on 142. It's yet to be seen if this change fixes the problem or not.
03-06-2006

EVALUATION From the first look, it looks like a plugin bug, hence changed the category to plugin.
18-05-2006

WORK AROUND Potential workaround code. public void requestFocus() { tItem.requestFocus(); }
17-05-2006