Closed
Bug 1074140
Opened 12 years ago
Closed 12 years ago
evt.preventDefault() does not work when an ajax request is dispatched along with a keydown event.
Categories
(Firefox :: Untriaged, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 540579
People
(Reporter: rohan.kumar, Unassigned)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
Steps to reproduce:
Firefox 32.0.3
I have a form with multiple input fields(say field1, field2, .....field8 ) in the form of a table-grid layout.
field1 has a keydown event attached. If there is a TAB event on field1, we fire an AJAX request and the focus is put in field2 based on some logic followed by a evt.preventDefault() to stop the browser default action.
Firefox browser fires the keydown event on the next field in the DOM order also cause of which focus shifts to another field(say field4 instead of field2) even if evt.preventDefault() is used.
The above works fine in IE11 and Chrome.
Actual results:
Firefox browser fires the keydown event on the next field in the DOM order also cause of which focus shifts to another field even if evt.preventDefault() is used.
Expected results:
evt.preventDefault() should have stopped browser default action and the focus should stay in the desired field once an AJAX request is dispatched on keydown.
Comment 1•12 years ago
|
||
Is the XHR request synchronous? Can you provide a minimal testcase?
(I expect this is a duplicate of bug 540579 or bug 151827, but without a testcase it's hard to be sure if so/which)
Flags: needinfo?(rohan.kumar)
Updated•12 years ago
|
Severity: critical → normal
Priority: P1 → --
Test case uploaded.
Steps to repro:
1. Download the attachments FF_bug.html and data.json in the same location.
2. Open FF_bug.html in Mozilla Firefox.
3. There are 5 input elements. Put focus in the First Name field.
4. Press TAB key to fire an AJAX synchronous request. As per the code the focus should be put in the Last Name field and the browser's default action should be stopped.
5. Instead focus skips to Email field.
Observe the difference in Chrome and IE.
Comment 5•12 years ago
|
||
So you're using a sync XHR request (async: false) and that triggers bug 540579.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•