Opened 11 years ago

Closed 11 years ago

#6806 closed defect (fixed)

Tree gets multiple tab stops

Reported by: guest Owned by: bill
Priority: high Milestone: 1.2
Component: Accessibility Version: 1.1.0
Keywords: Cc: chris@…
Blocked By: Blocking:

Description

  1. Go to http://download.dojotoolkit.org/current-stable/dojo-release-1.1.1/dijit/tests/tree/test_Tree_v1.html
  1. Expand Europe (using mouse!). Europe gets the focus.
  1. Press shift tab. BUG! Continents gets the focus.
  1. Reload browser. Europe should still be expanded.
  1. Press tab until focus arrives on the tree. Continents gets the focus.
  1. Press tab again. BUG! Europe gets the focus.

I think the patch below fixes both problems, but I haven't done a lot of testing.

Perhaps a better way to fix it would be to add a setLastFocused() method to Tree so we are setting tabindex in just one place (and so that users can set the lastFocused node if desired :-).

--- a/js-src/dijit/Tree.js
+++ b/js-src/dijit/Tree.js
@@ -210,10 +210,11 @@ dojo.declare(

                // On initial tree show, put focus on either the root node of the tree,
                // or the first child, if the root node is hidden
-               if(!this.parent){
+               if(this == tree.rootNode){
                        var fc = this.tree.showRoot ? this : this.getChildren()[0],
                                tabnode = fc ? fc.labelNode : this.domNode;
                        tabnode.setAttribute("tabIndex", "0");
+                       tree.lastFocused = fc;
                }

                // create animations for showing/hiding the children (if children exist)

Thanks, Chris Heath

Change History (3)

comment:1 Changed 11 years ago by bill

Owner: changed from Becky Gibson to bill
Status: newassigned

Hi Chris thanks for the test case and patch! Usually we require CLAs but since this is just two lines I think I can just change. (But bigger patches are always welcome assuming you've signed the CLA.)

BTW was the line if(!this.parent) failing, or is it just that this == tree.rootNode is clearer?

comment:2 Changed 11 years ago by guest

When I was debugging it, this.parent was always false/undefined. To be honest, I'm not sure if it ever gets set.

So I was seeing the if being called too many times (once for each expanded subtree).

comment:3 Changed 11 years ago by bill

Resolution: fixed
Status: assignedclosed

This was fixed by [13784], should have been closed automatically.

Note: See TracTickets for help on using tickets.