Skip to main content

Bug Tracker

Side navigation

#7444 closed bug (fixed)

Opened November 08, 2010 11:06PM UTC

Closed September 22, 2011 01:43AM UTC

Last modified March 08, 2012 10:46PM UTC

Submitting form with "Enter" instead of button click on ie8 or ie7 triggers live submit event twice.

Reported by: paul@iversant.com Owned by: dmethvin
Priority: high Milestone: 1.7
Component: event Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:
Description

Run the following using ie8 and you will see the event triggered twice. Run it in any other browser and it is triggered only once.

http://jsfiddle.net/paulrpayne/e38mm/

Attachments (0)
Change History (13)

Changed November 08, 2010 11:29PM UTC by jitter comment:1

IE 6 is also affected

Changed November 08, 2010 11:35PM UTC by boushley comment:2

I can confirm that this is not the case for a normal submit handler and that it also persists in the GIT 0 version of jQuery.

Changed November 09, 2010 01:15AM UTC by snover comment:3

component: unfiledevent
milestone: 1.51.4.5
priority: undecidedhigh
status: newopen

Not a regression.

Changed December 18, 2010 04:42PM UTC by iliakan comment:4

_comment0: That's because of a tricky IE behavior. \ \ When a user submits by pressing enter and the form has more than one text/password input field *and* there is a visible image/submit then IE generates onclick on the submit. \ \ Hence, the special.submit catches both click and keypress. \ \ The patch ignores keydown if it knows that IE will throw click. Up to IE8. \ \ \ \ 1292717309347334
_comment1: That's because of a tricky IE behavior. \ \ When a user submits by pressing enter and the form has more than one text/password input field *and* there is a visible image/submit then IE generates onclick on the submit. \ \ Hence, the special.submit catches both click and keypress. \ \ The patch ignores keydown if it knows that IE will throw click. Fixes the issue in all supported IE. \ \ \ \ 1292717322872717
_comment2: That's because of a tricky IE behavior. \ \ When a user submits by pressing enter and the form has more than one text/password input field *and* there is a visible image/submit then IE generates onclick on the submit. \ \ Hence, the special.submit catches both click and keypress. \ \ The patch ignores keydown if it knows that IE will throw click. Fixes the issue in IE 6,7,8. \ \ \ \ 1292752821867053
_comment3: That's because of a tricky IE behavior. \ \ When a user submits by pressing enter and the form has more than one text/password input field *and* there is a visible image/submit then IE generates onclick on the submit. \ \ Hence, the special.submit catches both click and keypress. \ \ The patch ignores keydown if it knows that IE will throw click. Fixes the issue in IE 6,7,8. \ \ https://github.com/jquery/jquery/pull/134 \ \ \ \ 1292752883221732

That's because of a tricky IE behavior.

When a user submits by pressing enter and the form has more than one text/password input field *and* there is a visible image/submit then IE generates onclick on the submit.

Hence, the special.submit catches both click and keypress.

The patch skips keydown if it knows that IE will throw click. Fixes the issue in IE 6,7,8.

https://github.com/jquery/jquery/pull/134

Changed December 18, 2010 05:07PM UTC by iliakan comment:5

_comment0: https://github.com/jquery/jquery/pull/1341292752833366515

Changed December 30, 2010 02:45AM UTC by snover comment:6

related to #6667?

Changed March 04, 2011 01:22PM UTC by iliakan comment:7

Don't think it is related. Also, #6667 appears to be fixed in 1.4.4, while #7444 is not fixed.

P.S. And yeah I know that's crazy.

Changed March 16, 2011 12:38PM UTC by xprommer comment:8

_comment0: I have experienced the same problems. \ This happens because the browser (i tested IE 6-7, Firefox 3.6.8, Opera 11.01, Chrome), when user press key "Enter" in text or password field, then the browser after (keydown, keypress, keyup) events send "click" event to the first submit or image button. That's why handler is called twice1300279901600122
_comment1: I have experienced the same problems. \ This happens because the browser (not only IE, i have tested IE 6-7, Firefox 3.6.8, Opera 11.01, Chrome), when user press key "Enter" in text or password field, then the browser after (keydown, keypress, keyup) events send "click" event to the first submit or image button. That's why handler is called twice1300280419833393
_comment2: I have experienced the same problems. \ This happens because the browser (not only IE, i have tested IE 6-8, Firefox 3.6.8, Opera 11.01, Chrome 10, Safari 5.0.4), when user press key "Enter" in text/password input field, then the browser after keydown/keypress/keyup events send "click" event to the first submit/image button. That's why handler is called twice. I guess that keypress.specialSubmit is unnecessary1305113587310946

I have experienced the same problems.

This happens because the browser (not only IE, i have tested IE 6-8, Firefox 3.6.8, Opera 11.01, Chrome 10, Safari 5.0.4), when user press key "Enter" in text/password input field, then the browser after keydown/keypress/keyup events send "click" event to the first submit/image button. That's why handler is called twice.

Changed May 16, 2011 04:53PM UTC by anonymous comment:9

If there are any alternatives for bypassing this problem?

Changed July 22, 2011 11:20PM UTC by paulrpayne comment:10

Is this ever going to be fixed on new releases, or are you waiting for ie to die? My workaround no longer works with the latest jQuery.

Changed September 15, 2011 03:08PM UTC by rrafal@gmail.com comment:11

I run into the same bug. I'm using the latest version of jQuery (1.6.4) and testing with IE7 and IE8. iliakan's description of the problem is what I see too.

Please help!

Changed September 22, 2011 01:42AM UTC by dmethvin comment:12

milestone: 1.next1.7
owner: → dmethvin
status: openassigned

Changed September 22, 2011 01:43AM UTC by dmethvin comment:13

resolution: → fixed
status: assignedclosed