mirror of
https://github.com/Sonarr/Sonarr
synced 2025-01-03 05:35:29 +00:00
Fixed enter in modal confirmation dialogs
This commit is contained in:
parent
482e2d5d42
commit
930742ae2c
2 changed files with 7 additions and 5 deletions
|
@ -30,10 +30,10 @@ function ConfirmModal(props) {
|
|||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
bindShortcut('enter', onConfirm);
|
||||
} else {
|
||||
unbindShortcut('enter', onConfirm);
|
||||
|
||||
return () => unbindShortcut('enter', onConfirm);
|
||||
}
|
||||
}, [onConfirm]);
|
||||
}, [isOpen, onConfirm]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
|
|
|
@ -56,9 +56,11 @@ function keyboardShortcuts(WrappedComponent) {
|
|||
}
|
||||
|
||||
unbindShortcut = (key) => {
|
||||
if (this._mousetrap != null) {
|
||||
delete this._mousetrapBindings[key];
|
||||
this._mousetrap.unbind(key);
|
||||
}
|
||||
}
|
||||
|
||||
unbindAllShortcuts = () => {
|
||||
const keys = Object.keys(this._mousetrapBindings);
|
||||
|
|
Loading…
Reference in a new issue