diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/emoji-menu/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/emoji-menu/component.jsx index 4fc25e4083..34dd61eb1c 100755 --- a/bigbluebutton-html5/imports/ui/components/actions-bar/emoji-menu/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/actions-bar/emoji-menu/component.jsx @@ -18,7 +18,94 @@ const propTypes = { class EmojiMenu extends Component { constructor(props) { super(props); + + // this.rovingIndex = this.rovingIndex.bind(this); } +/* + rovingIndex(...Args) { + const {users, openChats} = this.props; + let active = document.activeElement; + let list; + let items; + let count; + + function focusList() { + active.tabIndex = -1; + this.counter = 0; + list.tabIndex = 0; + list.focus(); + } + + if (Args[1] === 'users'){ + list = findDOMNode(this.refs.usersList); + items = findDOMNode(this.refs.userItems); + count = users.length; + }else if(Args[1] === 'messages'){ + list = findDOMNode(this.refs.msgList); + items = findDOMNode(this.refs.msgItems); + count = openChats.length; + } + + if(this.counter === -1 || this.counter > count){ + active.tabIndex = -1; + list.tabIndex = 0; + this.counter = 0; + list.focus(); + } + + if (Args[0].keyCode === KEY_CODES.ENTER + || Args[0].keyCode === KEY_CODES.ARROW_RIGHT + || Args[0].keyCode === KEY_CODES.ARROW_LEFT) { + active.firstChild.click(); + } + + if (Args[0].keyCode === KEY_CODES.ESCAPE) { + active.tabIndex = -1; + focusList(); + } + + if (Args[0].keyCode === KEY_CODES.ARROW_DOWN) { + if (this.counter < count) { + active.tabIndex = -1; + items.childNodes[this.counter].tabIndex = 0; + let newFocus = items.childNodes[this.counter]; + this.counter++; + newFocus.focus(); + }else if(this.counter === count){ + active.tabIndex = -1; + this.counter = -1; + list.tabIndex = 0; + list.focus(); + }else if(this.counter === 0) { + active.tabIndex = -1; + this.counter = 1; + items.childNodes[this.counter].tabIndex = 0; + let newFocus = items.childNodes[this.counter]; + newFocus.focus(); + } + } + + if (Args[0].keyCode === KEY_CODES.ARROW_UP) { + if (this.counter < count && this.counter !== 0) { + active.tabIndex = -1; + this.counter--; + items.childNodes[this.counter].tabIndex = 0; + let newFocus = items.childNodes[this.counter]; + newFocus.focus(); + }else if(this.counter === 0){ + active.tabIndex = -1; + this.counter = count; + list.tabIndex = 0; + list.focus(); + }else if (this.counter === count){ + active.tabIndex = -1; + this.counter = count - 1; + items.childNodes[this.counter].tabIndex = 0; + let newFocus = items.childNodes[this.counter]; + newFocus.focus(); + } + } + } */ render() { const { @@ -29,7 +116,7 @@ class EmojiMenu extends Component { return ( - +