import React, { PropTypes } from 'react'; class TextOutput extends React.Component { componentDidMount() { this.canvasTextOutput.focus(); } componentDidUpdate(prevProps) { // if the user explicitly clicks on the play button, want to refocus on the text output if (this.props.isPlaying && this.props.previewIsRefreshing) { this.canvasTextOutput.focus(); } } render() { return (
{ this.canvasTextOutput = element; }} tabIndex="0" aria-label="text-output" title="canvas text output" >

Output

); } } TextOutput.propTypes = { isPlaying: PropTypes.bool.isRequired, previewIsRefreshing: PropTypes.bool.isRequired }; export default TextOutput;