Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2120930 | 5.0u3 | Sean Coffey | P3 | Resolved | Fixed | b05 |
JDK-2120929 | 1.4.2_08 | Robert Mckenna | P3 | Resolved | Fixed | b01 |
FULL PRODUCT VERSION :
java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06) Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
We've seen this happening for quite some time, so the specific version of IE probably isn't critical. We've also seen it in previous versions of the Java plug-in, including 1.3.x.
A DESCRIPTION OF THE PROBLEM :
*** I submitted this bug 6 weeks ago (on Sept 11, 2003), and it was given an internal review ID of 207044. The confirmation email I received said there was a three week backlog. I still haven't heard the disposition of this report. Thank you. ***
The attached files show how an invisible applet "steals" focus from a form element. We have an applet on a page that performs some processing when called from JavaScript, but we don't want the applet itself to be visible on the page. Fortunately, we can disable its display by using style="display:none". However, when this applet is on the page, it grabs focus away from the HTML form field. It seems reasonable to us that this would be okay if the applet is visible, but if the applet isn't even being displayed, it shouldn't happen.
Enclosed:
TestApplet.java - a very simple applet.
good.html - An HTML file with a single form field. An onload script sets the focus to the form field. As soon as the page comes up, you can start typing, and the characters go into the form field. This is good. bad.html - Same as good.html, with the addition of an invisible applet. When it loads, you can see the cursor flash momentarily in the form field, but then if you start typing your keystrokes are lost. This is bad.
Note that the problem does not occur when using the Microsoft VM (5.0.0.3810), nor does it occur when using Netscape 7.1. Therefore, it appears to be an interaction between MSIE 6 and the Sun Plug-in.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description above. Just open bad.html in MSIE 6. When the page comes up, start typing. The characters go nowhere.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
When the page comes up, the characters you type should go into the form field.
ACTUAL -
When the page comes up, the characters you type go nowhere.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
---TestApplet.java---
import java.applet.*;
public class TestApplet extends Applet
{
public TestApplet ()
{
System.err.println( "TestApplet" );
}
public void init()
{
System.err.println( "TestApplet init" );
}
public void destroy()
{
System.err.println( "TestApplet destroy" );
}
}
---
---good.html---
<html>
<body onload="document.TestForm.TestField.focus()">
<form name="TestForm">
Field: <input name="TestField" size="40">
</form>
</body>
</html>
---
---bad.html---
<html>
<body onload="document.TestForm.TestField.focus()">
<applet code="TestApplet.class" width="2" height="2" style="display:none"></applet> <form name="TestForm">
Field: <input name="TestField" size="40">
</form>
</body>
</html>
---
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There are a couple of options here:
(1) Use Netscape instead of MSIE.
(2) In the onload code, use setTimeout() to reset the focus after a few hundred milliseconds. This gives the applet time to steal the focus, then we can steal it back.
(Incident Review ID: 218432)
======================================================================
###@###.### 10/13/04 10:09 GMT
- backported by
-
JDK-2120929 Invisible applet steals focus from HTML form field (MSIE, Sun plug-in only)
- Resolved
-
JDK-2120930 Invisible applet steals focus from HTML form field (MSIE, Sun plug-in only)
- Resolved
- duplicates
-
JDK-5038583 Plugin causes JSP to open behind browser window with applet
- Closed
-
JDK-5029338 REGRESSION: Applet steals focus of window after loading
- Closed
-
JDK-5062061 REGRESSION: New Frames wrongly display behind browser window
- Closed
-
JDK-4832148 Webpage updating in the background grabs focus
- Closed
- relates to
-
JDK-6206442 REGRESSION: JFrame goes to back after toFront() is called when Applet starts
- Resolved
-
JDK-6231186 When loading an applet with JVM 1.5 the first time, it steals window focus
- Resolved
-
JDK-6234219 Do not set initial focus on an applet during startup if applet is targeted for JDK 1.1/1.2
- Resolved
-
JDK-6939179 javascript form input field doesn't get focus upon applet starts
- Closed