Update tab.js
This commit is contained in:
parent
c11118ba23
commit
897f4db11a
1 changed files with 6 additions and 8 deletions
|
|
@ -59,10 +59,8 @@ const Selector = {
|
||||||
TABLIST: '[role="tablist"]'
|
TABLIST: '[role="tablist"]'
|
||||||
}
|
}
|
||||||
|
|
||||||
const Orientation = {
|
const ORIENTATION_VERTICAL = 'vertical'
|
||||||
VERTICAL: 'vertical',
|
const ORIENTATION_HORIZONTAL = 'horizontal'
|
||||||
HORIZONTAL: 'horizontal'
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------------------
|
* ------------------------------------------------------------------------
|
||||||
|
|
@ -227,12 +225,12 @@ class Tab {
|
||||||
static _dataApiKeydownHandler(event) {
|
static _dataApiKeydownHandler(event) {
|
||||||
const tablist = SelectorEngine.closest(event.target, Selector.TABLIST)
|
const tablist = SelectorEngine.closest(event.target, Selector.TABLIST)
|
||||||
let tabListOrientation = tablist.getAttribute('aria-orientation')
|
let tabListOrientation = tablist.getAttribute('aria-orientation')
|
||||||
if (tabListOrientation !== Orientation.VERTICAL) {
|
if (tabListOrientation !== ORIENTATION_VERTICAL) {
|
||||||
tabListOrientation = Orientation.HORIZONTAL
|
tabListOrientation = ORIENTATION_HORIZONTAL
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tabListOrientation === Orientation.HORIZONTAL && event.which !== ARROW_LEFT_KEYCODE && event.which !== ARROW_RIGHT_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)) {
|
(tabListOrientation === ORIENTATION_VERTICAL && event.which !== ARROW_UP_KEYCODE && event.which !== ARROW_DOWN_KEYCODE)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue