Fix keyboard shortcuts not working after selecting (#2756)

* Fix keyboard shortcuts not working after selecting
This commit is contained in:
WithoutPants 2022-07-22 17:25:48 +10:00 committed by GitHub
parent e532f9a683
commit db3138b33f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 12 deletions

View file

@ -1,4 +1,5 @@
### 🐛 Bug fixes
* Fix keyboard shortcuts not working after selecting an object. ([#2750](https://github.com/stashapp/stash/pull/2750))
* Fix UI crash on session timeout. ([#2755](https://github.com/stashapp/stash/pull/2755))
* Fix incorrect scene metadata being set when video has cover art. ([#2752](https://github.com/stashapp/stash/pull/2752))
* Fix incorrect image being displayed when first previewing image. ([#2754](https://github.com/stashapp/stash/pull/2754))

View file

@ -47,24 +47,23 @@ export const ListOperationButtons: React.FC<IListOperationButtonsProps> = ({
Mousetrap.bind("s a", () => onSelectAll?.());
Mousetrap.bind("s n", () => onSelectNone?.());
if (itemsSelected) {
Mousetrap.bind("e", () => {
Mousetrap.bind("e", () => {
if (itemsSelected) {
onEdit?.();
});
}
});
Mousetrap.bind("d d", () => {
Mousetrap.bind("d d", () => {
if (itemsSelected) {
onDelete?.();
});
}
}
});
return () => {
Mousetrap.unbind("s a");
Mousetrap.unbind("s n");
if (itemsSelected) {
Mousetrap.unbind("e");
Mousetrap.unbind("d d");
}
Mousetrap.unbind("e");
Mousetrap.unbind("d d");
};
});

View file

@ -65,7 +65,8 @@ export const GridCard: React.FC<ICardProps> = (props: ICardProps) => {
return (
<Form.Control
type="checkbox"
className="card-check"
// #2750 - add mousetrap class to ensure keyboard shortcuts work
className="card-check mousetrap"
checked={props.selected}
onChange={() => props.onSelectedChanged!(!props.selected, shiftKey)}
onClick={(event: React.MouseEvent<HTMLInputElement, MouseEvent>) => {