aboutsummaryrefslogtreecommitdiff
path: root/src/console
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-12-03 20:29:45 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-12-03 20:29:45 +0900
commit80de2149ad592c97158f1adb72b352dab3e0858e (patch)
tree697d1cf6ac625aacc4d3685ee37b7a051257f9ec /src/console
parent63b93ce1ca16e93563453e5caba451886fa3c01d (diff)
Focus console on shown
Diffstat (limited to 'src/console')
-rw-r--r--src/console/components/console.jsx10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/console/components/console.jsx b/src/console/components/console.jsx
index 70cbb4e..23c93e3 100644
--- a/src/console/components/console.jsx
+++ b/src/console/components/console.jsx
@@ -94,13 +94,12 @@ class ConsoleComponent extends Component {
if (prevProps.mode !== 'command' && this.props.mode === 'command') {
this.context.store.dispatch(
consoleActions.getCompletions(this.props.consoleText));
- this.input.focus();
+ this.focus();
} else if (prevProps.mode !== 'find' && this.props.mode === 'find') {
- this.input.focus();
+ this.focus();
}
}
-
render() {
switch (this.props.mode) {
case 'command':
@@ -123,6 +122,11 @@ class ConsoleComponent extends Component {
</Message>;
}
}
+
+ focus() {
+ window.focus();
+ this.input.focus();
+ }
}
const mapStateToProps = state => state;