From 897f4db11a06f9062c722555b841d7c3c52e2297 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 25 Nov 2020 15:02:12 +0200 Subject: [PATCH] Update tab.js --- js/src/tab.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/js/src/tab.js b/js/src/tab.js index 4146ebe1d..337f10cfb 100644 --- a/js/src/tab.js +++ b/js/src/tab.js @@ -59,10 +59,8 @@ const Selector = { TABLIST: '[role="tablist"]' } -const Orientation = { - VERTICAL: 'vertical', - HORIZONTAL: 'horizontal' -} +const ORIENTATION_VERTICAL = 'vertical' +const ORIENTATION_HORIZONTAL = 'horizontal' /** * ------------------------------------------------------------------------ @@ -227,12 +225,12 @@ class Tab { static _dataApiKeydownHandler(event) { const tablist = SelectorEngine.closest(event.target, Selector.TABLIST) let tabListOrientation = tablist.getAttribute('aria-orientation') - if (tabListOrientation !== Orientation.VERTICAL) { - tabListOrientation = Orientation.HORIZONTAL + if (tabListOrientation !== ORIENTATION_VERTICAL) { + tabListOrientation = ORIENTATION_HORIZONTAL } - if ((tabListOrientation === Orientation.HORIZONTAL && event.which !== ARROW_LEFT_KEYCODE && event.which !== ARROW_RIGHT_KEYCODE) || - (tabListOrientation === Orientation.VERTICAL && event.which !== ARROW_UP_KEYCODE && event.which !== ARROW_DOWN_KEYCODE)) { + if ((tabListOrientation === ORIENTATION_HORIZONTAL && event.which !== ARROW_LEFT_KEYCODE && event.which !== ARROW_RIGHT_KEYCODE) || + (tabListOrientation === ORIENTATION_VERTICAL && event.which !== ARROW_UP_KEYCODE && event.which !== ARROW_DOWN_KEYCODE)) { return }