diff --git a/components/Deck/ContentModulesPanel/ContentModulesPanel.js b/components/Deck/ContentModulesPanel/ContentModulesPanel.js index 3590db885..be20783f0 100644 --- a/components/Deck/ContentModulesPanel/ContentModulesPanel.js +++ b/components/Deck/ContentModulesPanel/ContentModulesPanel.js @@ -23,7 +23,7 @@ import PermissionsStore from '../../../stores/PermissionsStore'; import { isLocalStorageOn } from '../../../common.js'; import loadCollectionsTab from '../../../actions/collections/loadCollectionsTab'; import CollectionsPanel from './CollectionsPanel/CollectionsPanel'; -import { Dropdown } from 'semantic-ui-react'; +import { Button, Dropdown } from 'semantic-ui-react'; import { FormattedMessage, defineMessages } from 'react-intl'; class ContentModulesPanel extends React.Component { @@ -33,6 +33,29 @@ class ContentModulesPanel extends React.Component { this.state = { showMobileMenu: false }; + + this.keys = { + end: 35, + home: 36, + left: 37, + up: 38, + right: 39, + down: 40 + }; + + this.directions = { + 37: -1, + 38: -1, + 39: 1, + 40: 1 + }; + + // Binds + this.keyDownEventListener = this.keyDownEventListener.bind(this); + this.keyUpEventListener = this.keyUpEventListener.bind(this); + this.switchTabOnArrowPress = this.switchTabOnArrowPress.bind(this); + + this.tabs = null; } componentWillMount() { @@ -57,8 +80,103 @@ class ContentModulesPanel extends React.Component { } } } - + + + addTabListeners() { + + let tabs = document.querySelectorAll('[role="tab"]'); + for (let i = 0; i < tabs.length ; i++) { + // tabs[i].addEventListener('click', ...); + tabs[i].addEventListener('keydown', this.keyDownEventListener); + tabs[i].addEventListener('keyup', this.keyUpEventListener); + + // Build an array with all tabs (); {/*