Skip to main content

Search and Top Navigation

#9312 closed bug (fixed)

Opened May 17, 2013 12:17PM UTC

Closed May 23, 2013 11:57PM UTC

Last modified November 26, 2013 03:35PM UTC

Dialog: closes on enter in textbox in IE

Reported by: wibber Owned by:
Priority: minor Milestone: 1.10.4
Component: ui.dialog Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:
Description

When I open a jQuery UI Dialog widget and the content in the dialog contains a textbox the dialog automatically closes when I press enter. This seems to happen only when using IE9 or IE10. I do not want the dialog the close when I press enter in the textbox.

I have the following HTML:

<!DOCTYPE html>

<html>

<head>
<title>Testpage</title>

<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

<script type="text/javascript">
    $(document).ready(function() {
        $('#myDialog').dialog();
    });
</script>

</head> 

<body>  

    <div id="myDialog">
        Some text           
        <input type="text"></input>
    </div>

</body>
</html>
Attachments (0)
Change History (7)

Changed May 17, 2013 01:42PM UTC by tj.vantoll comment:1

status: newopen
summary: jQuery UI dialog closes on enterDialog: closes on enter in textbox in IE

Changed May 23, 2013 01:52AM UTC by tj.vantoll comment:2

IE has some very odd logic that will "click" <button> elements with enter is pressed in textboxes that are NOT within <form>s. Example: http://jsfiddle.net/tj_vantoll/QuEZE/

The fix is to explicitly indicate that the <button> is not a submit button by specifying type="button".

Pull request: https://github.com/jquery/jquery-ui/pull/995

Changed May 23, 2013 11:57PM UTC by TJ VanToll comment:3

resolution: → fixed
status: openclosed

Dialog: Add type="button" to the close button. Fixed #9312: Dialog: closes on enter in textbox in IE.

Changeset: c19e7b3496d14b40e71ba892213889fc8cc81d4f

Changed May 23, 2013 11:58PM UTC by tj.vantoll comment:4

milestone: none1.11.0

Changed July 31, 2013 07:45PM UTC by tj.vantoll comment:5

#9466 is a duplicate of this ticket.

Changed November 26, 2013 03:34PM UTC by TJ VanToll comment:6

Dialog: Add type="button" to the close button. Fixed #9312: Dialog: closes on enter in textbox in IE.

(cherry picked from commit c19e7b3496d14b40e71ba892213889fc8cc81d4f)

Changeset: 26238369bb113b487959322595e4814b441e5453

Changed November 26, 2013 03:35PM UTC by scottgonzalez comment:7

milestone: 1.11.01.10.4