mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-06 13:02:23 -07:00
Fixed enter in modal confirmation dialogs
(cherry picked from commit 930742ae2c69a530afe60f76a5824f2722540df8)
This commit is contained in:
parent
58cb0dc556
commit
ace7371b69
2 changed files with 7 additions and 5 deletions
|
@ -30,10 +30,10 @@ function ConfirmModal(props) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
bindShortcut('enter', onConfirm);
|
bindShortcut('enter', onConfirm);
|
||||||
} else {
|
|
||||||
unbindShortcut('enter', onConfirm);
|
return () => unbindShortcut('enter', onConfirm);
|
||||||
}
|
}
|
||||||
}, [onConfirm]);
|
}, [isOpen, onConfirm]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
|
|
@ -56,8 +56,10 @@ function keyboardShortcuts(WrappedComponent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unbindShortcut = (key) => {
|
unbindShortcut = (key) => {
|
||||||
delete this._mousetrapBindings[key];
|
if (this._mousetrap != null) {
|
||||||
this._mousetrap.unbind(key);
|
delete this._mousetrapBindings[key];
|
||||||
|
this._mousetrap.unbind(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unbindAllShortcuts = () => {
|
unbindAllShortcuts = () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue