Skip to content

Commit

Permalink
Merge pull request #45054 from code-dot-org/javalab-console-fix
Browse files Browse the repository at this point in the history
Java Lab Console: only jump to bottom when running or testing
  • Loading branch information
molly-moen committed Feb 26, 2022
2 parents 71056c4 + f9e3e04 commit a28555a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions apps/src/javalab/JavalabConsole.jsx
Expand Up @@ -51,7 +51,8 @@ class JavalabConsole extends React.Component {
displayTheme: PropTypes.oneOf(Object.values(DisplayTheme)),
isPhotoPrompterOpen: PropTypes.bool,
closePhotoPrompter: PropTypes.func,
photoPrompterPromptText: PropTypes.string
photoPrompterPromptText: PropTypes.string,
shouldJumpToInput: PropTypes.bool
};

state = {
Expand Down Expand Up @@ -183,7 +184,10 @@ class JavalabConsole extends React.Component {
};

onLogsClick = () => {
this.inputRef.focus();
// only jump to input if the program is currently in run or test mode.
if (this.props.shouldJumpToInput) {
this.inputRef.focus();
}
};

render() {
Expand Down Expand Up @@ -243,7 +247,8 @@ export default connect(
consoleLogs: state.javalab.consoleLogs,
displayTheme: state.javalab.displayTheme,
isPhotoPrompterOpen: state.javalab.isPhotoPrompterOpen,
photoPrompterPromptText: state.javalab.photoPrompterPromptText
photoPrompterPromptText: state.javalab.photoPrompterPromptText,
shouldJumpToInput: state.javalab.isRunning || state.javalab.isTesting
}),
dispatch => ({
appendInputLog: log => dispatch(appendInputLog(log)),
Expand Down

0 comments on commit a28555a

Please sign in to comment.