United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6426928 : focus lost within text item after applet is shown again

Details
Type:
Bug
Submit Date:
2006-05-17
Status:
Resolved
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2006-06-26
Component:
deploy
OS:
windows_2000
Sub-Component:
plugin
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.4.2_11
Fixed Versions:
1.4.2_13 (b01)

Related Reports

Sub Tasks

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.
                                     
2006-06-03
EVALUATION

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

Potential workaround code.

   public void requestFocus() {
      tItem.requestFocus();
  }
                                     
2006-05-17



Hardware and Software, Engineered to Work Together