[TIP] Keyboard shortcuts

[TIP] Keyboard shortcuts

  
Even though an application with great UX tends to be easy to use I think most power users rely on keyboard shortcuts.
I recently deliver a PoC for a customer where the Call center operators are used to have keyboard shortcuts for some basic tasks and to somehow mimic that behavior I end up building a simple script that allowed them no navigate among tabs (using Rich Widget’s client side tabs) just by using keyboard shortcuts (ALT+F1 for first tab, ALT+F2 for second tab and so on).

It’s a very basic script but I think it could be useful in similar situations:

osjs(document).keyup(function (e) {
    try{
        //ALT+F1 - ALT+F12
        if(e.altKey && e.keyCode >= 112 && e.keyCode <= 124){
            var currentTab = e.which-111;
            
            osjs('ul.Tabs_Header').find('li:nth-child(' + currentTab + ')').find('a').click();
        }
    }catch(e){}
});