Ticket #4065 (closed bug: fixed)
modal dialog + button locks page
| Reported by: | Vovochka | Owned by: | scott.gonzalez |
|---|---|---|---|
| Priority: | major | Milestone: | 1.7.2 |
| Component: | ui.dialog | Version: | 1.6rc6 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
After executing this code the page freezes (I can't follow links)
$("#oo_add_img_box")
.dialog({
modal: true,
buttons: {
'OK': function() {
$(this).dialog('close');
}
}
})
.dialog('close');
But if I delete buttons section everything works fine
Attachments
Change History
comment:1 Changed 4 years ago by scott.gonzalez
- Priority changed from blocker to major
- Milestone changed from TBD to 1.6
Changed 4 years ago by jgailor
-
attachment
4065-fix.diff
added
This is the patch file which fixes the problem
comment:2 Changed 4 years ago by jgailor
Submited a fix for this as an attached patch file. Please send feedback/advice/criticisms if it doesn't meet the guidelines for the jquery-ui codebase.
Thanks
Jeremy
comment:3 Changed 4 years ago by scott.gonzalez
This patch is not valid as dialogs are not supposed to be destroyed on close.
comment:4 Changed 4 years ago by jgailor
I think I misunderstood the bug. The bug as described here I was unable to reproduce in Safari or Firefox on OS X (Leopard). I created a page with a link that triggers the pop-up using the code provided when clicked, and another link to random page http://some.website.com/. After triggering the pop-up and closing the window, the link to the random page worked fine.
comment:5 Changed 4 years ago by rmorero
I can confirm this issue.
Browsers: IE6, IE7 (possibly IE8). Works fine in Mozilla/Webkit derivates.
jQuery version: 1.3.1 Minified jQuery UI version: 1.6rc6 Minified Works fine with jQuery 1.2.6 and UI 1.5
Scenario: Opening a dialog with modal:true and buttons hangs IE6 & IE7
Expected result: A modal dialog is opened with 2 buttons, "Save" and "Cancel".
Actual result: In IE6, I get a quick glimpse of an opening dialog (but without content), and then the browser hangs. In IE7, browser hangs directly. IE CPU/Memory usage increases dramatically.
Code:
jQuery(function($){
$("#dialogDiv").dialog({
modal:true,
buttons: {
'Cancel': function(){
$(this).dialog("close");
},
'Save': function(){
alert("Saving");
}
}).show();
}
comment:7 Changed 4 years ago by scott.gonzalez
- Owner set to scott.gonzalez
- Status changed from new to assigned
comment:8 Changed 4 years ago by scott.gonzalez
- Status changed from assigned to closed
- Resolution set to fixed
Fixed in r2395.
comment:9 Changed 4 years ago by kapouer
Using r2528, the bug still holds.
using html on the page, i do :
$("#dialog-login").dialog({
bgiframe: true,
autoOpen: false,
modal: true,
closeOnEscape: true,
buttons: {
OK: function() {
// some stuff here
}
}
});
then a button is responsible for opening the dialog :
$("#dialog-login").dialog('open');
on IE8, i get a infinite loop before seeing anything.
comment:10 Changed 4 years ago by kapouer
it also hangs even if the button is removed.
it doesn't if modal: false
hope this helps
comment:14 Changed 4 years ago by BalusC
This is certainly not fixed in 1.7.2.
Related bug: http://dev.jqueryui.com/ticket/4758
The root cause is the setting 'modal' which creates an overlay which on its turn get assigned a handler for window resize. In IE8 this handler called in an infinite loop.
comment:15 Changed 4 years ago by scott.gonzalez
This is fixed in 1.7.2. The infinite loop in IE8 is a completely unrelated bug.
comment:16 Changed 3 years ago by ignacio.cavina
I just fund that this happens to get fixed if I comment this line:
var $overlays = $([]); $.each($.ui.dialog.overlay.instances, function() {
$overlays = $overlays.add(this);
});
maybe this helps, any pointers on how to solve this would be very much appreciated
comment:17 Changed 3 years ago by ignacio.cavina
then, I:
var $overlays = $([]);
// $.each($.ui.dialog.overlay.instances, function() {
// $overlays = $overlays.add(this);
// });
$overlays = $overlays.add($.ui.dialog.overlay.instances[0]);
but not sure if this will break other stuff. My guess is that in IE6 it starts recurring forever.
comment:18 Changed 2 years ago by yourmom
This bug (IE hangs upon opening modal dialog) still occurs in UI v1.8.12, with any version of jQuery (1.4,5,6). Not sure why this is marked fixed.
Tested in IE7, which proceeds to use 100% CPU. Whether a button exists is irrelevant to the problem.
Also see http://stackoverflow.com/questions/5669553/jquery-dialog-ie6-and-ie7-hangs and http://groups.google.com/group/jquery-ui/browse_thread/thread/885cad0360b5fb99
The jsfiddle in the first link also reproduces the problem.
comment:19 Changed 2 years ago by scott.gonzalez
This works fine if you include the required CSS. See http://jsfiddle.net/sh9qM/2/
comment:20 Changed 2 years ago by yourmom
Thanks, including the CSS does fix the hanging problem.


You should use the autoOpen: false option instead of closing the dialog immediately after instantiation.