Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Improve POS navigation #252
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunkat committed Feb 17, 2017
1 parent da0c980 commit 2a738f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,10 @@ class Table extends Component {
break;
case 'Tab':
e.preventDefault();
document.getElementsByClassName('js-attributes')[0].focus();
const focusedElem = document.getElementsByClassName('js-attributes')[0];
if(focusedElem){
focusedElem.getElementsByTagName("input")[0].focus();
}
break;
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/components/widget/Devices/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ class Device extends Component {
})
}

handleKey = (e) => {
const {handleChange} = this.props;
const {value} = this.state;

switch(e.key){
case 'Enter':
handleChange(value);
break;
}
}

render() {
const {value, index, isMore} = this.state;
const {tabIndex} = this.props;
Expand All @@ -67,6 +78,7 @@ class Device extends Component {
onFocus={() => this.handleToggleChangeStopper(true)}
onMouseLeave={() => this.handleToggleChangeStopper(false)}
onBlur={() => this.handleToggleChangeStopper(false)}
onKeyDown={(e) => this.handleKey(e)}
>
{isMore && <span className="btn-flag">{index + 1}</span>}
{value}
Expand Down

0 comments on commit 2a738f1

Please sign in to comment.