Handle LEFT Arrow as expected by Aria Treeview Widget pattern

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2019-10-17 17:49:28 +01:00
parent f72ff95efb
commit fe46925c00

View file

@ -133,6 +133,13 @@ const RoomSubList = createReactClass({
// Prevent LeftPanel handling Tab if focus is on the sublist header itself // Prevent LeftPanel handling Tab if focus is on the sublist header itself
ev.stopPropagation(); ev.stopPropagation();
break; break;
case Key.ARROW_LEFT:
// On ARROW_LEFT collapse the room sublist
if (!this.state.hidden && !this.props.forceExpand) {
this.onClick();
}
ev.stopPropagation();
break;
case Key.ARROW_RIGHT: { case Key.ARROW_RIGHT: {
ev.stopPropagation(); ev.stopPropagation();
if (this.state.hidden && !this.props.forceExpand) { if (this.state.hidden && !this.props.forceExpand) {
@ -181,14 +188,11 @@ const RoomSubList = createReactClass({
}, },
onKeyDown: function(ev) { onKeyDown: function(ev) {
// On ARROW_LEFT collapse the room sublist // On ARROW_LEFT go to the sublist header
if (ev.key === Key.ARROW_LEFT) { if (ev.key === Key.ARROW_LEFT) {
ev.stopPropagation(); ev.stopPropagation();
if (!this.state.hidden && !this.props.forceExpand) {
this.onClick();
this._headerButton.current.focus(); this._headerButton.current.focus();
} }
}
}, },
onRoomTileClick(roomId, ev) { onRoomTileClick(roomId, ev) {