vakata/jstree

Keyboard binding checks use invalid case sensitive sorting.

Closed this issue · 0 comments

Within the core.keyboard module I'm able to define an event for something like:

'shift-down': function (e) {

This works fine, the event is triggered, and the instance is correctly triggered to the bound function.

However the same does not apply for:

'shift-up': function (e) {

There is a core issue in the way that the sorting is applied within _kbevent_to_func.

Due to the way JS works when the array parts are created using upper AND lowercase characters when the sort method is called the output is different and stops the function being returned.

This causes a difference between the two variables that are compared between tmp and parts. Causing them to never match and not returning the bound function.

To reproduce define a core.keyboard section with the contents:

, 'keyboard': {

    'shift-up': function (e) {
        console.log ('Shift Up Triggered.');
    }

    , 'shift-down': function (e) {
        console.log ('Shift Down Triggered.');
    }

}

When pressing shift + down it will work as expected. But the same doesn't work for shift + up.

Will submit a PR shortly.