diff --git a/browser/main/TopBar/index.js b/browser/main/TopBar/index.js index 0b193623..2688a159 100644 --- a/browser/main/TopBar/index.js +++ b/browser/main/TopBar/index.js @@ -44,11 +44,12 @@ class TopBar extends React.Component { isIME: false }) + // When the key is an alphabet, del, enter or ctr if (e.keyCode <= 90) { this.setState({ - isAlphabet: true, - isIME: false + isAlphabet: true }) + // When the key is an IME input (Japanese, Chinese) } else if (e.keyCode === 229) { this.setState({ isIME: true @@ -58,6 +59,12 @@ class TopBar extends React.Component { handleKeyUp (e) { + // reset states + this.setState({ + isConfirmTranslation: false + }) + + // When the key is translation confirmation (Enter) if (this.state.isIME && e.keyCode === 13) { this.setState({ isConfirmTranslation: true @@ -67,10 +74,6 @@ class TopBar extends React.Component { this.setState({ search: this.refs.searchInput.value }) - } else { - this.setState({ - isConfirmTranslation: false - }) } }