// always when clicking an item, focus it
setFocusedNode(this, false);
- /*
- * Also ensure that the Tree itself is also gains focus (TreeNodes
- * focus is kind of faked).
- */
- // if (BrowserInfo.get().isOpera()) {
- /*
- * focusing the tree in Opera would scroll long trees up on clicks
- */
- // getElement().focus();
- // } else if (!BrowserInfo.get().isIE()) {
- // focus();
- // } // else if IE: NOP, IE will give the focus to Tree anyways
-
ScheduledCommand command = new ScheduledCommand() {
public void execute() {
} else {
focusedNode.setFocused(true);
}
- // focus();
}
final MouseEventDetails details = new MouseEventDetails(evt);
ScheduledCommand command = new ScheduledCommand() {
DOM.appendChild(getElement(), ie6compatnode);
DOM.sinkEvents(ie6compatnode, Event.ONCLICK);
- } // else if (BrowserInfo.get().isOpera()) {
- /*
- * We need to focus the TreeNode itself to get keyboard navigation
- * to work in opera at some level. Actually focusing individual
- * TreeNodes would most likely be better option for all browsers, I
- * don't dare to to this at bugfix release. MT.
- */
- getElement().setTabIndex(-1);
- // }
+ }
nodeCaptionDiv = DOM.createDiv();
DOM.setElementProperty(nodeCaptionDiv, "className", CLASSNAME
DOM.appendChild(nodeCaptionDiv, wrapper);
DOM.appendChild(wrapper, nodeCaptionSpan);
+ /*
+ * Focus the caption div of the node to get keyboard navigation to
+ * work without scrolling up or down when focusing a node.
+ */
+ nodeCaptionDiv.setTabIndex(-1);
+
childNodeContainer = new FlowPanel();
childNodeContainer.setStyleName(CLASSNAME + "-children");
setWidget(childNodeContainer);
ie6compatnode.addClassName(CLASSNAME_FOCUSED);
}
this.focused = focused;
- getElement().focus();
+ nodeCaptionDiv.focus();
treeHasFocus = true;
} else if (this.focused && !focused) {
nodeCaptionDiv.removeClassName(CLASSNAME_FOCUSED);