Closed Bug 162317 Opened 22 years ago Closed 12 years ago

java applet losing focus - cursor in text field without focus

Categories

(Core Graveyard :: Java: OJI, defect, P3)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE
mozilla1.3beta

People

(Reporter: roger, Assigned: James.Melvin)

References

()

Details

Attachments

(3 files)

This is happening in a major bank in Brazil.

The page starts with focus on the Agência text field. If you click on the applet
text field, the cursor appears in this field and another cursor continues in the
HTML text field.

If the mouse pointer is over the applet, then the focus is in the applet
(although there are two cursors in the page). If the mouse pointer is out the
applet doesn't have the focus anymore. It works fine on windows.

I'm using a recente nighty build with java 1.3.1_02. To test the bank URL it is
necessary java 1.4.0, java 1.3.1 will silently close the browser.

The guys at the bank sent me a test case for this. It can be found at:
http://200.210.8.13/~roger/bb/testeHTML/tecla.html

I will attach the java source code.
The java applet captures keyboard events and prints the character. It will only
work if the mouse is over the applet on linux.

Oh, and workarounds for this in the applet side are also welcome! ;)
Could it be DOM?
I am not sure I understand the problem in the test case here. I tried it with
different builds of moz1.0 (nightly and release) with either JRE1.3.1_02 or
1.4.1, and the results were the same: the focus was in the text box (the only
one place that text could be entered) when page was first loaded. I was able to
enter text into the text box. Then clicked outside of the text box (anywhere,
either on the applet area or out in the blank area), the focus in text box
disappeared. But when I clicked in the text box again, the focus came back to
the text box, and I was able to type in text again. I did not see two cursors,
nor two text boxes.
Am I missing something here?
Joe, sorry for the confusion. The two cursors were appearing at the bank page:
https://www2.bancobrasil.com.br/aapf/aai/login.pbk

The test case, http://200.210.8.13/~roger/bb/testeHTML/tecla.html ,
shows an applet which captures keyboard events and draws the character in the
yellow rectangle.

On windows, after clicking over the applet the cursor disappears from the text
field. I can type and the character appears in the yellow rectangle no matter
where the mouse pointer is (the keyboard focus is with the applet). This is the
expected behavior.

On linux, after clicking over the applet, the cursor remains in the text field
and the applet only draws the typed characters in the yellow rectangle if the
mouse pointer is over the applet otherwise the characters go to the text field.
Any idea why this is happening?
I've created a simplier testcase. The page has two input fields, one HTML and
one java. This shows better the focus problem on linux:

http://200.210.8.13/~roger/bb/testeHTML/tecla2.html
Roger, now I am able to reproduce the problem in the new test cases. Could you
attach the Java code of the new test case (the last, simplify one)?
Sure! Source code of the applet with an input field.
This problem seems to be a Java plugin problem only happened on Unix. The test
case worked fine on Windows, with Netscape 7.0 or mozilla. On Unix (linux and
Solaris), any Netscape or mozilla, as long as running with Java plugin (I tested
from 1.2.2 to 1.4.1rc), the same problem occurred. With Netscape 4.7x, if the
embeded Java was used, the test case worked OK. But as soon as I enabled Java
plugin, the problem happened.

It looks like somehow in Java plugin, when a new focus is created in an applet's
text field, the original focus in the text field outside of the applet still
exists. So there were two focus exist at the same time, and one can enter text
in either of the text fields by moving the mouse around.

Re-assign to Java plugin group.
Assignee: joe.chou → James.Melvin
Confirmed bug to new status.
Status: UNCONFIRMED → NEW
Ever confirmed: true
This likely to be the same problem as bug 101082.

As far as i remember at that time we discovered that this is some 
imcompatibility between focus handling implementations in jdk and 
mozilla (actually may be even gtk and motif). 

there was a bug against jdk about this (i can not recall its bugtraq id) 
and jdk developers told us it 
will be fixed in 1.4.1. But may be they fixed only part of it.
Joe, it seems like the testcase crashes the browser in Unix. Looks like it
stucks at OJI module.

Fixed in 1.4.2
Wrong Id. Please ignore #12. Sorry.
Xiaobin (comment #11): the test case should not cause crash (at least in my
testing and Roger' testing), and the problem is the double focuses. See my
comment #8 for more details. With NS4.7x, without Java plugin (using embeded
java), it works fine, and the original focus is eliminated as expected. But if
enable java plugin, NS4.7x also has the same problem. So this looks like a Java bug.
I have the latest test case installed in our internal site:
  http://javaweb/~joechou/bug162317/test.html
You can give it a try.
Steve:

Can you take a look at this problem? 
Blocks: 145287
This file reproduce this bug using only motif.	It's flow is analogus to the
way this is actually done with the plugin.
I don't think this is a gtk/motif/awt interaction problem.  The above attachment
reproduces this using only motif.  This leads me to the conclusion that we have
a fundamental problem with our mechanism for embedding the applet window.

In short we are creating a top level window (vendorShell) and sneaking into the
browsers widget tree.  It might look like a child window, but it behaves like it
would if it were interacting with the window manager directly.
QA Contact: pmac → petersen
Priority: -- → P3
Target Milestone: --- → mozilla1.3beta
Product: Core → Core Graveyard
Mass-closing bugs in the "OJI" component: OJI plugin integration was replaced with npruntime long ago, and these bugs appear to be irrelevant now. If there is in fact a real bug that remains, please file it new in the "Core" product, component "Plug-ins".
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: