Closed
Bug 326484
Opened 19 years ago
Closed 8 years ago
Double characters/keypresses when using alert with onkeydown
Categories
(Core :: Widget: Win32, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: rgqld, Unassigned)
Details
(Keywords: testcase)
Attachments
(2 files)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 If call a function that displays an alert box from the keydown event of a text input element, the last key entry is duplicated in the input's value. Reproducible: Always Steps to Reproduce: 1. Sample code: <script type="text/javascript"> function showText(t) { alert(t); } </script> <input type="text" onkeydown="showText('blah');"> 2. Press 'a' key, see 'a' in input and alert with 'blah'. 3. Dismiss alert, get second 'a' in input, now shows 'aa'. 4. Press 'b', see 'aab' in input. 5. Dismiss alert, get 'aabb' in input 6. Press 'c', get 'aabbc', dismiss alert, get 'aabbcc'. 7. Press 'Backspace', last character deleted, see 'aabbc' in input. 8. Dismiss alert, see 'aabb' in input. 9. Move cursor to after first 'b', press 'backspace', see 'aab'. 10. Dismiss alert, see 'ab' in input. Actual Results: It seems a second key press of whatever the last key was is entered when the alert is dismissed (except for Esc key). Pressing tab key seems to enter serveral tab presses. Expected Results: Should not see additional characters in the input. Using the value of the input as the text in the alert shows the same text as is in the input while the alert is being displayed. I used 'blah' to show that any text can be used in the alert to cause the duplication of keystrokes. Ending the script with 'return false' seems to pevent the behaviour, but it changes the behaviour of other browsers (e.g. prevents any entry into the field in IE) making it not suitable for a general web environment.
Comment 1•19 years ago
|
||
Updated•19 years ago
|
Component: General → JavaScript Engine
Product: Firefox → Core
Version: unspecified → 1.8 Branch
Updated•19 years ago
|
Assignee: nobody → general
QA Contact: general → general
Comment 2•19 years ago
|
||
Steve, this isn't a JS engine bug. It looks like a complaint the our execution model (if you can call it that) doesn't match other browsers. /be
Component: JavaScript Engine → DOM: Level 0
(In reply to comment #2) > Steve, this isn't a JS engine bug. It looks like a complaint the our execution > model (if you can call it that) doesn't match other browsers. I think it's a bug. Almost every keydown (Esc key excepted) is duplicated as a result of calling 'alert' from the onkeydown handler.
Comment 4•19 years ago
|
||
I'm sure it's a bug, just not in the JS engine was my point. Behavior of the DOM level 0 was never specified, but we should do something sane, and if IE does that already, we should match. Ideally the whatwg.org will specify all these corner cases. /be
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 5•19 years ago
|
||
> 2. Press 'a' key, see 'a' in input and alert with 'blah'.
On Linux I see an alert and absolutely nothing in the input. Same after I dismiss the alert.
Sounds to me like a widget issue with event delivery, given the platform differences....
Assignee: general → win32
Component: DOM: Level 0 → Widget: Win32
QA Contact: general → ian
(In reply to comment #5) > > 2. Press 'a' key, see 'a' in input and alert with 'blah'. > > On Linux I see an alert and absolutely nothing in the input. Same after I > dismiss the alert. > > Sounds to me like a widget issue with event delivery, given the platform > differences.... > I get exactly the same on Mac OS X with: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 Any keypress shows the alert, but nothing is entered into the input.
Comment 7•18 years ago
|
||
(In reply to comment #6) > Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) > Gecko/20060111 Firefox/1.5.0.1 > > Any keypress shows the alert, but nothing is entered into the input. > Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4 Exactly the same problem :(
Comment 8•18 years ago
|
||
Is anyone seeing this in trunk?
Comment 9•16 years ago
|
||
(In reply to comment #8) > Is anyone seeing this in trunk? Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 Confirmed on 3.0 and latest trunk. The double character entry isn't present, but if you do a(alert)b(alert)c(alert)back(alert) the result is 'a' in the text edit with the backspace deleting two characters. The first is deleted before the alert shows, the second after it closes.
Updated•15 years ago
|
Assignee: win32 → nobody
QA Contact: ian → win32
Updated•13 years ago
|
Version: 1.8 Branch → Trunk
Comment 10•9 years ago
|
||
A modification to the previous bug to show it is still an issue. Pressing tab in the first input box applies tab twice and moves it to the third input box.
Comment 11•9 years ago
|
||
The same does not only happen with alert boxes, but also with syncronous XMLHttpRequests.
Comment 12•8 years ago
|
||
this works for me with Windows 10 and latest Nightly 50.0a1, 20160722030235 it is also WFM on Mac 10.11 with latest Nightly 50.0a1, 20160722030235
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•