diff --git a/bigbluebutton-html5/imports/ui/components/polling/component.jsx b/bigbluebutton-html5/imports/ui/components/polling/component.jsx index 9221ac87864d68e2c29ea7be7c0bc4ec5b127612..af6965462ded04c6f4f12974b876296c8040f230 100644 --- a/bigbluebutton-html5/imports/ui/components/polling/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/polling/component.jsx @@ -50,6 +50,7 @@ class Polling extends Component { this.play = this.play.bind(this); this.handleUpdateResponseInput = this.handleUpdateResponseInput.bind(this); + this.handleMessageKeyDown = this.handleMessageKeyDown.bind(this); } componentDidMount() { @@ -68,6 +69,21 @@ class Polling extends Component { this.setState({ typedAns: this.responseInput.value }); } + handleMessageKeyDown(e) { + const { + poll, + handleTypedVote, + } = this.props; + + const { + typedAns, + } = this.state; + + if (e.keyCode === 13) { + handleTypedVote(poll.pollId, typedAns); + } + } + render() { const { isMeteorConnected, @@ -167,6 +183,9 @@ class Polling extends Component { onChange={(e) => { this.handleUpdateResponseInput(e); }} + onKeyDown={(e) => { + this.handleMessageKeyDown(e); + }} type="text" className={styles.typedResponseInput} placeholder={intl.formatMessage(intlMessages.responsePlaceholder)} @@ -199,6 +218,7 @@ Polling.propTypes = { formatMessage: PropTypes.func.isRequired, }).isRequired, handleVote: PropTypes.func.isRequired, + handleTypedVote: PropTypes.func.isRequired, poll: PropTypes.shape({ pollId: PropTypes.string.isRequired, answers: PropTypes.arrayOf(PropTypes.shape({