#9000 closed bug (fixed)
Dialog leaves broken event handler after close/destroy in certain cases
Reported by: | olejorgenb | Owned by: | |
---|---|---|---|
Priority: | blocker | Milestone: | 1.10.1 |
Component: | ui.dialog | Version: | 1.10.0 |
Keywords: | regression | Cc: | |
Blocked by: | Blocking: |
Description
(See attached testcase)
Create and open a modal dialog. Close it. Destroy it. Focus an element in a separate javascript block/"thread" later.
Result:
Uncaught TypeError: Cannot call method '_focusTabbable' of undefined jquery-ui-1.10.0.custom.js:5730 $.widget._createOverlay._delay._on.focusin jquery-ui-1.10.0.custom.js:5730 handlerProxy jquery-ui-1.10.0.custom.js:706 jQuery.event.dispatch jquery-1.8.3.js:3058 jQuery.event.add.elemData.handle.eventHandle jquery-1.8.3.js:2676 jQuery.event.trigger jquery-1.8.3.js:2941 jQuery.fn.extend.trigger jquery-1.8.3.js:3599 jQuery.extend.each jquery-1.8.3.js:611 jQuery.fn.jQuery.each jquery-1.8.3.js:241 jQuery.fn.extend.trigger jquery-1.8.3.js:3598 jQuery.each.jQuery.fn.(anonymous function) jquery-1.8.3.js:3652 $.fn.extend.focus jquery-ui-1.10.0.custom.js:62 (anonymous function) test.html:11
This happens (ASFAICS) because _destroyOverlay is called both on close and destroy, decreasing $.ui.dialog.overlayInstances twice, causing the check marked below to not work as intended.
_createOverlay: function() { if ( !this.options.modal ) { return; } if ( !$.ui.dialog.overlayInstances ) { // Prevent use of anchors and inputs. // We use a delay in case the overlay is created from an // event that we're going to be cancelling. (#2804) this._delay(function() { // Handle .dialog().dialog("close") (#4065) ------> if ( $.ui.dialog.overlayInstances ) { this._on( this.document, { focusin: function( event ) { if ( !$( event.target ).closest(".ui-dialog").length ) { event.preventDefault(); $(".ui-dialog:visible:last .ui-dialog-content") .data("ui-dialog")._focusTabbable(); } } }); } }); }
Change History (11)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Keywords: | regression added |
---|---|
Milestone: | none → 1.10.1 |
Priority: | minor → major |
Status: | new → open |
comment:5 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Dialog: Don't handle overlays on destory if there are not any. Fixed: #9004 - failed in _destroyOverlay when I destroy a modal dialog thau was never opened. Fixed: #9000 Dialog leaves broken event handler after close/destroy in certain cases
Changeset: 649f105229b2a24adc21cba2d56cb05a59711ccb
comment:6 Changed 10 years ago by
This says closed but I built from the latest code and the bug is still there.
comment:10 Changed 10 years ago by
@TUX Please stop posting blocks of code into the ticket. This ticket has been closed for a while. If there's a new bug, please file a new ticket.
comment:11 Changed 10 years ago by
Comenten esta linea de codigo del Jquery y con eso se soluciona:
$(".ui-dialog:visible:last .ui-dialog-content")
.data("ui-dialog")._focusTabbable();
Saludos desde Merida, Yucatan...
Can't upload attachments? Here's an jsfiddle http://jsfiddle.net/FUMfS/