diff --git a/src/App.js b/src/App.js index cf16905..42be4ef 100644 --- a/src/App.js +++ b/src/App.js @@ -42,6 +42,11 @@ class App extends React.Component { constructor(props) { super(props); this.state = { numToRecall: '12345', isInputMode: true }; + this.startButton = React.createRef(); + } + + focusStartButton = () => { + this.startButton.current.focus(); } componentDidMount() { @@ -81,7 +86,9 @@ class App extends React.Component { return ( <> {mainDisplay} - +
length of number:
Number of reps:
diff --git a/src/source.js b/src/source.js index 56215f8..9b4ff62 100644 --- a/src/source.js +++ b/src/source.js @@ -61,6 +61,7 @@ class AppEngine { var msg = "succeeded in "+this.currentSetRecord.getNumOfSuccessfulExercises()+" out of "+ this.currentSetRecord.getNumOfExercises(); this.guiController.setNumToRecall(msg); + this.guiController.focusStartButton(); } return false; @@ -196,7 +197,6 @@ class ReactGui { } - activateDisplayMode() { } @@ -204,6 +204,10 @@ class ReactGui { var stateToSet = { numToRecall: numToRecall, isInputMode: false }; this.appComponent.setState(stateToSet) } + + focusStartButton() { + this.appComponent.focusStartButton(); + } } var appEngine = new AppEngine(new ReactGui());