Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9312 closed bug (fixed)

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>

Change History (7)

comment:1 Changed 5 years ago by tj.vantoll

Status: newopen
Summary: jQuery UI dialog closes on enterDialog: closes on enter in textbox in IE

comment:2 Changed 5 years ago by tj.vantoll

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

comment:3 Changed 5 years ago by TJ VanToll

Resolution: fixed
Status: openclosed

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

Changeset: c19e7b3496d14b40e71ba892213889fc8cc81d4f

comment:4 Changed 5 years ago by tj.vantoll

Milestone: none1.11.0

comment:5 Changed 5 years ago by tj.vantoll

#9466 is a duplicate of this ticket.

comment:6 Changed 5 years ago by TJ VanToll

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

comment:7 Changed 5 years ago by Scott González

Milestone: 1.11.01.10.4
Note: See TracTickets for help on using tickets.