fix: submit button is not clickable on challenge completion modal
This commit is contained in:
@ -26,13 +26,13 @@ const mapStateToProps = createSelector(
|
|||||||
const mapDispatchToProps = function(dispatch) {
|
const mapDispatchToProps = function(dispatch) {
|
||||||
const dispatchers = {
|
const dispatchers = {
|
||||||
close: () => dispatch(closeChallengeModal()),
|
close: () => dispatch(closeChallengeModal()),
|
||||||
submitChallenge: (e) => {
|
handleKeypress: (e) => {
|
||||||
if (
|
if (e.keyCode === 13 && (e.ctrlKey || e.meta)) {
|
||||||
e.keyCode === 13 &&
|
|
||||||
(e.ctrlKey || e.meta)
|
|
||||||
) {
|
|
||||||
dispatch(submitChallenge());
|
dispatch(submitChallenge());
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
submitChallenge: () => {
|
||||||
|
dispatch(submitChallenge());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return () => dispatchers;
|
return () => dispatchers;
|
||||||
@ -40,6 +40,7 @@ const mapDispatchToProps = function(dispatch) {
|
|||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
close: PropTypes.func.isRequired,
|
close: PropTypes.func.isRequired,
|
||||||
|
handleKeypress: PropTypes.func.isRequired,
|
||||||
isOpen: PropTypes.bool,
|
isOpen: PropTypes.bool,
|
||||||
message: PropTypes.string,
|
message: PropTypes.string,
|
||||||
submitChallenge: PropTypes.func.isRequired
|
submitChallenge: PropTypes.func.isRequired
|
||||||
@ -51,6 +52,7 @@ export class CompletionModal extends PureComponent {
|
|||||||
close,
|
close,
|
||||||
isOpen,
|
isOpen,
|
||||||
submitChallenge,
|
submitChallenge,
|
||||||
|
handleKeypress,
|
||||||
message
|
message
|
||||||
} = this.props;
|
} = this.props;
|
||||||
return (
|
return (
|
||||||
@ -59,7 +61,7 @@ export class CompletionModal extends PureComponent {
|
|||||||
dialogClassName={ `${ns}-success-modal` }
|
dialogClassName={ `${ns}-success-modal` }
|
||||||
keyboard={ true }
|
keyboard={ true }
|
||||||
onHide={ close }
|
onHide={ close }
|
||||||
onKeyDown={ isOpen ? submitChallenge : noop }
|
onKeyDown={ isOpen ? handleKeypress : noop }
|
||||||
show={ isOpen }
|
show={ isOpen }
|
||||||
>
|
>
|
||||||
<Modal.Header
|
<Modal.Header
|
||||||
|
Reference in New Issue
Block a user