mbraak / jqTree

Tree widget for jQuery
https://mbraak.github.io/jqTree/
Apache License 2.0
1.02k stars 177 forks source link

Opening a 'load_on_demand' node using the keyboard causes the keyboard-focus to be lost #669

Closed Jaccoky closed 2 years ago

Jaccoky commented 2 years ago

I am implementing further keyboard the jqtree component. I am having troubles with opening nodes that are using 'load_on_demand'. The focussed node you open using the keyboard (for example by using the right-arrow key) loses focus (and also the whole tree loses focus). Therefor, you cannot continue navigating using the keyboard.

If you re-focus the tree and close and re-open the (now loaded) node, the focus remains as expected.

I tried all kind of things but I just cannot get this to work. I did manage to re-focus the node after loading, but then the key-strokes where not handled correctly anymore (causing the tree to scroll instead of navigating throug nodes).

You can test this at: https://development.bluepolar.com/TestJQtree/TestJQtree.html

Simply navigate through this tree using the keyboard. Each time you open a node for the first time, the focus is lost and you will have to re-focus using the mouse. When you close and re-open an already loaded node, there are no issues.

Any help is welcome.

mbraak commented 2 years ago

I will have a look. Thanks for the example.

mbraak commented 2 years ago

I have added a pr with a fix: #670

Jaccoky commented 2 years ago

This works great! Many thanks for the very fast response.