Closed Bug 452376 Opened 16 years ago Closed 14 years ago

Input text element gets wrong keyup events

Categories

(Firefox :: General, defect)

13 Branch
x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: hubert.kauker, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

When an input text element has a keyup event handler which opens an alert box to display some message, and the alert box is closed by pressing the RETURN key,
then a keyup event with keyCode == 13 is fired on the text element.


Reproducible: Always

Steps to Reproduce:
1. Assign the following event handler to any input element of type text:
   document.getElementById( "text1" ).onkeyup = function( event ) {
       alert( event.keyCode );
   };
2. Type anything into the text element, e.g. the digit "1".
3. An alert box will open saying "49".
4. Try to close the alert box by pressing the RETURN key.

Actual Results:  
5. The alert box will open again saying "13".
6. This will continue forever.
7. You must close the alert box by clicking on the OK button.


Expected Results:  
8. The alert box should close and no event should be fired on the text element.

The confirm and prompt boxes have the same problem.
The keydown and keypress events to NOT have the problem.
This is a mass search for bugs which are in the Firefox General component, are
UNCO, have not been changed for 500 days and have an unspecified version. 

Reporter, can you please update to Firefox 3.6.10 or later, create a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles, and test again. If you still see the issue, please update this bug. If the issue is gone, please set the status to RESOLVED > WORKSFORME.
Whiteboard: [CLOSEME 2010-11-01]
No reply from reporter, INCOMPLETE. Please retest with Firefox 3.6.12 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INCOMPLETE
This bug is still in Firefox 13.0.1.

Here is a test page...

<html>
  <head>
    <title>Bug 452376</title>
    <script>
      window.onload = function() {
        document.getElementById( "text1" ).onkeyup = function( event ) {
          alert( event.keyCode );
        };
        document.getElementById( "text2" ).onkeyup = function( event ) {
          confirm( event.keyCode );
        };
        document.getElementById( "text3" ).onkeyup = function( event ) {
          prompt( event.keyCode );
        };
      };
    </script>
  </head>

  <body>
    <input type="text" id="text1">
    <input type="text" id="text2">
    <input type="text" id="text3">
    <br>
    Type any key, and when the popup shows type RETURN.
  </body>
</html>
The following seems to happen:

- popup appears
- keyboard input focus remains on original text input element

Keyboard focus should move to the popup, instead, so that RETURN key activates the OK button.
It is interesting to note that onkeydown and onkeypress do not have this problem.
OS: Windows 2000 → Windows 7
Whiteboard: [CLOSEME 2010-11-01]
Version: unspecified → 13 Branch
I put the above test case in attachment form, so it can be quickly opened.

The problem still persists with version 40.0.3 (Windows).

For example:
 - open the attachment
 - right click in one text field
 - in the context menu select an item by keyboard and confirm it (use cursor keys to select and enter to confirm, for example the "Check Spelling" option)

Result:
 - the enter key is visible and captured to the page JS code
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: