Opened 8 years ago

Closed 8 years ago

#13387 closed defect (fixed)

Dialog: throws an exception when trying to set focus inside a slow loading iframe document

Reported by: Khazad Owned by: bill
Priority: high Milestone: 1.7
Component: Dijit Version: 1.6.0
Keywords: dialog iframe Cc:
Blocked By: Blocking:

Description

We're using the dijit.Dialog to host legacy pages. When these pages take some time to load the auto focus functionality throws an exception since the document body is not yet available when trying to set focus. Either the focus should wait for the document to load or just have null reference handling and skip the focus. The following row in dijit.Dialog is throwing the exception since "body" is null:

return body.contentEditable == 'true'
(body.firstChild && body.firstChild.contentEditable == 'true');

I'm getting this problem in Firefox 4. IE9 seems to work but it generally seems faster loading my dialog so I'm not sure if the problem may appear there as well.

Change History (3)

comment:1 Changed 8 years ago by Douglas Hays

Owner: set to bill

That's weird since the focus is set only after onLoad is called. You can also set autoFocus=false in the widget.

comment:2 Changed 8 years ago by bill

Milestone: tbd1.7
Status: newassigned
Summary: Dijit.dialog throws an exception when trying to set focus inside a slow loading iframe documentDialog: throws an exception when trying to set focus inside a slow loading iframe document

Well, the onload event is just for when the ContentPane (or Dialog) loads the contents from an href, not for when an iframe inside the Dialog loads contents natively. Like Doug said, you can set autoFocus=false as a workaround, but I'll add in the check for body not being defined too.

comment:3 Changed 8 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [25800]) Avoid null pointer exception for Dialog containing iframe, where the Dialog tries to focus the first element (on open) but the iframe hasn't finished loading yet. Fixes #13387 !strict.

Note: See TracTickets for help on using tickets.