Closed Bug 199316 Opened 21 years ago Closed 21 years ago

blur() triggered by onkeypress in text box blurs self instead of referenced object

Categories

(Core :: DOM: Events, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 53579

People

(Reporter: ndm, Assigned: saari)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4a) Gecko/20030326
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4a) Gecko/2003032604

Background:  The fidelity.com site could not be used to transact on-line mutual
fund trades in Mozilla because you can't enter more than 1 digit in a dollar
amount text box.  (The site works in IE.)  I unravelled its convoluted
JavaScript down to this simple test case that exhibits the problem.   I also
reproduced it in the 1.3 official Mozilla release.

Reproducible: Always

Steps to Reproduce:
1. Create and load the following the following HTML file (I'll try to attach
it later):

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
     "http://www.w3.org/TR/html4/loose.dtd">
  <HTML LANG="EN-US">
  <head>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
  <title></title>
  </head>
  <body>
  <form name="tradeForm" action="dummy.html">
  <input type="text" size="8" name="QTY_TYPE_D" value=""
  onkeypress="document.tradeForm.TMP_CHOOSE_SPECIFIC_SHARES.blur();">
  <input type="checkbox" name="TMP_CHOOSE_SPECIFIC_SHARES" value="">
  </form> </body> </html>

2. Click on the left-hand text box.  Result: cursor blinks (focus is achieved).

3. Type the digit "1".  Result:  "1" appears in the box, but cursor
disappears (focus becomes lost).


Actual Results:  
Focus becomes lost on the textbox, even though the blur() references the
checkbox.

Expected Results:  
Since the blur() references the checkbox, not the textbox, focus should not be
removed from the textbox, so that more digits can be entered.  In fact nothing
should be done, since the checkbox is already blurred by definition (since 
you are in the textbox).

Note:  In the test case, the blur() on non-self may appear to be a dumb thing to
do, but on the actual web page the blur() is deeply nested in a generic reset
function triggered by various conditions.

Workaround:  Now that I understand the problem, I can use the fidelity.com
site to make trades by re-clicking to focus after entering each digit.  So for
me it's a minor nuisance.  But the average user would not know this.
This attachment is the test case HTML code above.
I see this too in LInux 2003032608

*** This bug has been marked as a duplicate of 53579 ***
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: