Opened 8 years ago

Closed 8 years ago

#10654 closed defect (fixed)

Dialog: exception closing Dialog opened from non-focusable button

Reported by: joshilay Owned by: bill
Priority: high Milestone: 1.6
Component: Dijit Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:

Description

On hiding any dialog widget via method call i.e dialog.hide(), firebug is showing the following exception everytime:

exception in animation handler for: onEnd dojo.js (line 16) [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLInputElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: https://localhost/vep/includes/js/dojo/dojo/getScripts.js :: anonymous :: line 16" data: no]

Attachments (1)

dojotest.html (1.6 KB) - added by Chris2 8 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 8 years ago by bill

Component: GeneralDijit
Resolution: worksforme
Status: newclosed

You didn't attach a test case or say which version of firefox and firebug you are using. Anyway, I tried test_Dialog.html on FF3.6rc1/mac with firebug 1.4.5, and closing a dialog (which presumably calls dialog.hide()) works fine.

I also tried the same test on FF3.5.7/windows (firebug 1.4.5) and no errors in the console then either.

If you have a test case that reproduces the problem feel free to attach it and reopen this ticket, with a description of how to reproduce the problem.

comment:2 Changed 8 years ago by kcjonson

Resolution: worksforme
Status: closedreopened

Ive been seeing this bug as well. Working on a test case.

Reported: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2) Gecko/20100123 Ubuntu/9.10 (karmic) Firefox/3.6

Seems to be an extremely uncommon FF bug: http://forums.mozillazine.org/viewtopic.php?f=38&t=336715&start=0&st=0&sk=t&sd=a

Was able to track it down to Dialog.js -> _setup -> this._fadeOut = dojo.fadeOut -> onEnd -> if (this.refocus) -> dijit.focus(focus);

The variable focus is null when this error occurs.

A quick fix is to wrap it in an

if (focus) {dijit.focus(focus);}

Doesn't seem to repro well in a clean environment however, trying to get a consistent case.

comment:3 Changed 8 years ago by kcjonson

Actually, that quick fix doesnt work in all cases. Moving the focus inside does however.

Proposed: if(this.refocus){

if(ds.length > 0){

var focus = this._savedFocus; var pd = ds[ds.length-1]; if(!dojo.isDescendant(focus.node, pd.domNode)){

pd._getFocusItems(pd.domNode); focus = pd._firstFocusItem;

} dijit.focus(focus);

}

}

comment:4 Changed 8 years ago by James Burke

Owner: changed from anonymous to bill
Status: reopenednew

comment:5 Changed 8 years ago by bill

Resolution: worksforme
Status: newclosed

As I stated above, "If you have a test case that reproduces the problem feel free to attach it and reopen this ticket, with a description of how to reproduce the problem." But don't reopen the ticket without attaching a test case.

comment:6 Changed 8 years ago by Chris2

Resolution: worksforme
Status: closedreopened

I was experiencing the same bug today, and i was able to create a test case which reproduces the problem. In my case it has something to do with dijit.form.TextBox? and showing the dijit.Dialog using the onclick-event of an image. When the TextBox? is removed or the Dialog is opened using a dijit.form.Button everything works fine. And also i am experiencing this bug only in Firefox (3.6.6).

Changed 8 years ago by Chris2

Attachment: dojotest.html added

comment:7 Changed 8 years ago by Chris2

I forgot to mention that i use: WinXP Firebug 1.5.4

And also i have added the test case as attachment to this ticket. ;)

comment:8 Changed 8 years ago by bill

Milestone: tbd1.6
Summary: Error on calling dialog.hide()Dialog: exception on calling dialog.hide()

Great, thanks for the test case, I was able to reproduce the problem. It's getting an exception trying to refocus whatever was focused before the Dialog was shown... but the problem is that nothing was focused.

You can workaround the problem by setting refocus: false as a Dialog parameter.

comment:9 Changed 8 years ago by bill

Summary: Dialog: exception on calling dialog.hide()Dialog: exception closing Dialog opened from non-focusable button

comment:10 Changed 8 years ago by bill

Resolution: fixed
Status: reopenedclosed

(In [22548]) focus() back to original button that opened dialog will fail if the original button isn't focusable; in this case ignore the exception. fixes #10654 !strict.

Note: See TracTickets for help on using tickets.