Closed Bug 856420 Opened 13 years ago Closed 10 years ago

event.preventDefault is not working on the latest version of Firefox

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

x86_64
Windows 7
defect
Not set
major

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: salimfayad, Unassigned)

Details

(Keywords: regressionwindow-wanted)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0 Build ID: 20130307023931 Steps to reproduce: On the event of keydown, I am checking if the "enter" key has been clicked. If yes, then I focus the next input text. But there is another event which is on "blur" of this input text that validates the input to check if it is greater than a specific value, then it stops all the events by using the "event.preventDefault" Actual results: After installing the latest version of Firefox, it is not working any more. I even tried all the combinations: event.preventDefault event.stopPropagation event.stopImmediatePropagation return false None of them worked. On IE, it is working. Expected results: Those event stop bubbeling should work
Severity: normal → major
minimal testcase please.
Does this still reproduce for you? If so, a testcase showing the problem would be very helpful :)
Flags: needinfo?(salimfayad)
Closing this as incomplete due to inactivity and the lack of a reproducible test case. Feel free to reopen the bug if there's an updated testcase that still reproduces the issue.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Flags: needinfo?(salimfayad)
Resolution: --- → INCOMPLETE
Hi guys, I was able to reproduce the issue. The issue is reproducible on Windows in Firefox version 49.0.2 and 43.0.1. can see behavior in: https://jsfiddle.net/vy8nuvz6/3/ The code used is the following: HTML <form role="form"action="" method="get"> <input id="input" type="suggest" placeholder="" value="" autocomplete="off"> <button id="mysubmit" type="submit" >submit</button> </form> JS var btn = document.getElementById("mysubmit"), input = document.getElementById("input"); input.onkeydown = function(e){ if(e.which === 13){ e.preventDefault(); e.stopPropagation(); alert("keyDown"); return false; } }; btn.onclick = function(e){ alert("onclick"); }; Please, I wait your answer
I tried the testcase in comment 4 and it does behave differently in Chrome and Firefox Nightly. In FF pressing enter shows a keyDown alert, followed by onclick, and then the form is submitted and the page reloads. In Chrome pressing enter only shows a keyDown alert, and the form is not submitted.
In FF 27 (as a random choice) the testcase behaves like Chrome. FF 47 only shows an onclick alert before submitting the form (???).
FF 45 and 48 behave like Chrome. FF 49 behaves like nightly. This seems to conflict with the results from comment 4. I'm going to go ahead and open a new bug for this.
I have filed bug 1316330.
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.