Fixed: Enter on Delete profile confirmation deleting all unused profiles

This commit is contained in:
Mark McDowall 2020-03-20 08:37:35 -07:00
parent 72afb28c30
commit 4ddf4a22a3
1 changed files with 9 additions and 3 deletions

View File

@ -23,11 +23,16 @@ function ConfirmModal(props) {
isSpinning,
onConfirm,
onCancel,
bindShortcut
bindShortcut,
unbindShortcut
} = props;
useEffect(() => {
bindShortcut('enter', onConfirm);
if (isOpen) {
bindShortcut('enter', onConfirm);
} else {
unbindShortcut('enter', onConfirm);
}
}, [onConfirm]);
return (
@ -81,7 +86,8 @@ ConfirmModal.propTypes = {
isSpinning: PropTypes.bool.isRequired,
onConfirm: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired,
bindShortcut: PropTypes.func.isRequired
bindShortcut: PropTypes.func.isRequired,
unbindShortcut: PropTypes.func.isRequired
};
ConfirmModal.defaultProps = {