Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12534 closed defect (fixed)

Dialog: reopen fails when the show action is connected to an unfocusable node

Reported by: limepix Owned by: bill
Priority: high Milestone: 1.7
Component: Dijit Version: 1.6.0
Keywords: dijit Dialog DialogLevelManager getFocus Cc:
Blocked By: Blocking:

Description

I´ve encoutered a problem with dijit.Dialog. It seems, that the DialogLevelManager? has a problem with setting a correct focus when a Dialog has an focusable input field in its content and is opened via an onclick handler from a UNFOCUSABLE node (i.e. an image). The error occurs when the Dialog is opened for the second time via the image. The error message that i see in Firebug is:

exception in animation handler for: beforeBegin

[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLInputElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://172.16.1.50:8080/teamportal/js/dojo-release-1.6.0-src/dojo/_base/_loader/bootstrap.js :: anonymous :: line 511" data: no] http://172.16.1.50:8080/teamportal/js/dojo-release-1.6.0-src/dojo/./_base/fx.js Line 154

The problem can be reproduced on my attached testpage. If you open the Dialog from the button, close it and reopen it via the button, everything works fine!

But if you remove the focus from the button, open the dialog via the image, close it and then try to reopen it via the image, it crashes.

The exact place where i can see it crash is:

/dijit/Dialog.js on line 484: 483 Save current focus 484 ds[ds.length-1].focus = dijit.getFocus(dialog);

My environment is: Firefox 3.6.15 Firebug 1.6.2 Dojo 1.6

Hope this helps and will be fixed soon!

Attachments (1)

testcase.gsp (1.8 KB) - added by limepix 8 years ago.
testcase

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by limepix

Attachment: testcase.gsp added

testcase

comment:1 Changed 8 years ago by bill

Milestone: 1.6.11.7
Summary: Reopen dijit.Dialog fails, when the show action is connected to an image in FirefoxDialog: reopen fails when the show action is connected to an unfocusable node

comment:2 Changed 8 years ago by millennium

[PATCH][CLA]

I fixed this in the DestroyRecursive? of the Dialog. But I guess it should be in the destroy of _Widget;

destroyRecursive: function () {
  //Remove my focus of my soon to be destroyed nodes if any 
  //Keep this fix till Ticket #12534 is fixed
  if (dojo.isDescendant(dijit._curFocus, this.domNode))
    dijit._curFocus = null;
  if (dojo.isDescendant(dijit._prevFocus, this.domNode))
    dijit._prevFocus = null;
  this.inherited(arguments);
}

comment:3 Changed 8 years ago by bill

Owner: set to bill
Status: newassigned

Ah OK thanks for the patch, yes I agree that _curFocus etc. has to be cleared before a node is destroyed, so the code above should run whenever a widget's DOM is destroyed (i.e. whenever a widget is destroyed, unless the preserveDom argument is set to true).

I think I want to achieve that by making dijit/focus monitor calls to dojo.destroy() and clear those variables.

It may not be quite sufficient because older versions of IE get cranky when you destroy the node with focus, I remember lots of issues with InlineEditBox but unfortunately don't remember the details.

comment:4 Changed 8 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [24911]) Various fixes so that Dialog doesn't try to focused destroyed nodes. Fixes #12534 !strict.

comment:5 Changed 8 years ago by bill

(In [25287]) Make sure the unfocusable button doesn't split across two rows, as that confuses DOH robot's mouseMove() code. Refs #12534.

Note: See TracTickets for help on using tickets.