dojo / dapi

Dojo 1 - API viewer.
11 stars 5 forks source link

tree link not selected #30

Closed wkeese closed 11 years ago

wkeese commented 11 years ago

On the old viewer, navigating http://dojotoolkit.org/api/1.9/dijit/Fieldset will select dijit/Fieldset in the left hand tree, but something like http://localhost:3000/api/1.9/dijit/Editor just leaves the tree closed.

Likewise, switching back to a previously opened tab should select the corresponding row in the Tree, but doesn't.

http://dojotoolkit.org/api/1.9/dijit/Fieldset isn't perfect either though because it doesn't scroll to the selected Tree element.

lbod commented 11 years ago

That's fine, i can plug it into the setTreePath function in api.js.. However what did you think of the "auto scrolling" to the treeitem when a tab is switched? It feels a bit annoying at times as it always focusses to the top of the tree viewport.

wkeese commented 11 years ago

I guess ideally it should only scroll when necessary to bring the element into view, and then only scroll the minimal amount. Or alternately scroll to the middle of the viewport? You should be able to get the former behavior with dojo/window::scrollIntoView().

lbod commented 11 years ago

This is probably a temp fix bill whilst you have a look. dojo/window::scrollIntoView() wasn't my expected behaviour, there's also still an outstanding task to make sure permalinked urls work when switching tabs etc - the current behaviour means the tree item is focussed but when switching between other opened items it no longer focusses on the first permalinked tree item so i'll reopen to remember to fix it (time is a bit short at the moment)

wkeese commented 11 years ago

OK. Hopefully you mean "selected" not "focused", because I don't think you should ever be focusing the tree label programatically.

It looks like you're passing the wrong argument to scrollIntoView(), i.e. pasing the widget instead of the DOMNode.

lbod commented 11 years ago

Ah, I'm leaving commented code in (which all needs to be removed) where you're maybe being confused.

I'm using node.scollIntoView to make sure the selected (yes sorry i meant selected) tree item is scrolled to the viewport. edit: you're completely right, dojo/window.scrollIntoView is much better, I'll fix the remaining defect on this with scrolling when a permalink is loaded first, thanks