Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#4664 closed defect (fixed)

tree item focus and onToggleOpen

Reported by: guest Owned by: simonjb
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: tree onToggleOpen Cc: [email protected]…, alex
Blocked By: Blocking:


dojo: 0.90

browser: Explorer 6.0

error message: ... cannot activate hidden control ...

context: expand and collapse a subtree when the focused item is inside the subtree

proposed solution: modify 'onToggleOpen' in 'dijit\_treeController.js' (line 254) by adding 'node.tree.focusNode(node)' maybe after collapsing

onToggleOpen: function(/*Object*/ message){
	// summary: user clicked the +/- icon; expand or collapse my children.
	var node = message.node;
		node.tree.focusNode(node); // <<<< proposed solution

Attachments (1)

4664a.diff (766 bytes) - added by simonjb 15 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 15 years ago by bill

Milestone: 2.01.0
Owner: set to simonjb

This seems worth doing for 1.0 if only a one line change. Simon, you did the tree stuff right?

comment:2 Changed 15 years ago by davidb

The proposed fix looks good to me.

comment:3 Changed 15 years ago by simonjb

Status: newassigned

Ok, thanks David.

comment:4 Changed 15 years ago by simonjb

David did the tree keyboard implementation but I'm happy to take this ticket.

comment:5 Changed 15 years ago by davidb

Simon, I would try to make sure focus was in the subtree for the collapsing node prior to setting focus programmatically. (You're probably doing that anyways)

comment:6 Changed 15 years ago by simonjb

It turns out that there is actually already logic to move focus when collapsing a node. And it has a check to make sure that we are collapsing a subtree with focus. The check is always failing in IE. On IE it looks like focus is never in the collapsing subtree and focus is never moved. The logic checks for tabindex=0 using dojo.query. There are cross-browser issues with tabindex. We should address these but for now I thought I'd try a different approach. See attachment.

Changed 15 years ago by simonjb

Attachment: 4664a.diff added

comment:7 Changed 15 years ago by bill

Cc: alex added

Simon, that seems reasonable although if dojo.query("[tabindex=0]", node) isn't working on IE can you file a separate bug about it, assigned to alex? (Hopefully there is a simple testcase like with some static HTML.)

comment:8 Changed 15 years ago by simonjb

Resolution: fixed
Status: assignedclosed

(In [10926]) Use dojo.isDescendant() rather than dojo.query("[tabindex=0]") to check if we are collapsing a subtree with focus. dojo.query("[tabindex=0]") was always returning an empty list on IE. Also fixed a issue with focus being lost when collapsing a subtree that does not have focus. Fixes #4664.

comment:9 Changed 14 years ago by bill

(In [13122]) After dropping nodeC into nodeP, where nodeP is collapsed, this._lastFocused would still be pointing to nodeC, and clicking nodeP's expando would fail since it tried to refocus on nodeC even though nodeC was hidden. Workaround this by making expando-click focus on the node w/the expando. Maybe that's the right behavior anyway? Not sure. Fixes #6232. Refs #4664.

Note: See TracTickets for help on using tickets.