Start keyboard navigation on hover

69 views
Skip to first unread message

Sandro

unread,
Mar 22, 2014, 4:30:15 PM3/22/14
to jst...@googlegroups.com
Hi Ivan,

first of all thanks for creating, maintaining and enhancing this tree component, it worked very well for me!
I'm in the process of switching to the 3.0 version and would like to reproduce a behavior from the 1.0 version. There it was possible to start navigating with the keyboard beginning with the focused or hovered element. Like you see here:
http://www.jcrbrowser.org/sling/.jcrbrowser.view.html
or here
http://old.jstree.com/demo
Now I have to click on an element in order to be able to start navigating from it. You can see it at the homepage: http://www.jstree.com/. The click on an element has an other function. Is it possible to somehow restore the old behavior?

Best,

Sandro


Ivan Bozhanov

unread,
Mar 22, 2014, 5:39:29 PM3/22/14
to jst...@googlegroups.com
Just focus the anchor when it is hovered - like so:
$('#tree').on("mouseenter", ".jstree-anchor", function () { $(this).focus(); })

Sandro

unread,
Mar 22, 2014, 7:02:08 PM3/22/14
to jst...@googlegroups.com
Thanks for your quick answer Ivan!
It didn't work out of the box but I will have a closer look tomorrow. It looks like a nice and simple solution.

Best,

Sandro

Sandro

unread,
Mar 24, 2014, 6:10:33 PM3/24/14
to jst...@googlegroups.com
I couldn't really figure out why I get an "too much recursions" error with this solution. But with
.on('hover_node.jstree', function (event, data) {
    $
('#'+data.node.id+' a:first').focus();
})
it works.


Best,

Sandro

Am Samstag, 22. März 2014 22:39:29 UTC+1 schrieb Ivan Bozhanov:
Reply all
Reply to author
Forward
0 new messages