From b5c1de9fc8449ffe4313c809e1f2d103837109b2 Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Mon, 11 Jul 2016 18:07:01 -0300 Subject: [PATCH] Bug fixed in keyboard shortcuts navigation Related #31 --- app/Application.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/app/Application.js b/app/Application.js index ca6fa7ed..2426506c 100644 --- a/app/Application.js +++ b/app/Application.js @@ -38,11 +38,8 @@ Ext.define('Rambox.Application', { ,handler: function(key) { var tabPanel = Ext.cq1('app-main'); var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab()); - if ( !tabPanel.items.items[activeIndex + 1] ) { - activeIndex = -1; - } else if ( tabPanel.items.items[activeIndex + 1].tabConfig.xtype === 'tbfill' ) { - activeIndex++; - } + if ( tabPanel.items.items[activeIndex + 1] && tabPanel.items.items[activeIndex + 1].id === 'tbfill' ) activeIndex++; + if ( !tabPanel.items.items[activeIndex + 1] ) activeIndex = -1; tabPanel.setActiveTab( activeIndex + 1 ); } } @@ -54,12 +51,10 @@ Ext.define('Rambox.Application', { ,handler: function(key) { var tabPanel = Ext.cq1('app-main'); var activeIndex = tabPanel.items.indexOf(tabPanel.getActiveTab()); - if ( !tabPanel.items.items[activeIndex - 1] ) { - activeIndex = tabPanel.items.length; - } else if ( tabPanel.items.items[activeIndex - 1].tabConfig.xtype === 'tbfill' ) { - activeIndex--; - } - tabPanel.setActiveTab( activeIndex - 1 ); + if ( tabPanel.items.items[activeIndex - 1] && tabPanel.items.items[activeIndex - 1].id === 'tbfill' ) activeIndex--; + if ( !tabPanel.items.items[activeIndex - 1] && tabPanel.items.items.length !== 2 ) activeIndex = tabPanel.items.items.length; + if ( tabPanel.items.items.length === 2 ) activeIndex = 1; + tabPanel.setActiveTab( activeIndex - 1 ); } } ,{