From 8bb1da0ed5369106d83ad81b515fea6e33664067 Mon Sep 17 00:00:00 2001 From: KDSBrowne Date: Sat, 6 May 2017 16:04:59 -0700 Subject: [PATCH] fix focus and tab order bugs --- .../actions-bar/emoji-menu/component.jsx | 101 +++++++++++++++++- .../ui/components/dropdown/list/component.jsx | 36 +++---- .../dropdown/list/item/component.jsx | 6 +- .../components/dropdown/trigger/component.jsx | 6 +- .../nav-bar/settings-dropdown/component.jsx | 2 +- .../ui/components/user-list/component.jsx | 3 +- .../user-list/user-list-item/component.jsx | 3 +- 7 files changed, 130 insertions(+), 27 deletions(-) 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 ( - +