fix(web): improve focus and shortcuts (#7983)

* fix(web): improve focus and shortcuts

* fix shiftKeyIsDown
This commit is contained in:
Michel Heusschen
2024-03-15 17:01:35 +01:00
committed by GitHub
parent a46366d336
commit 029dd99ae0
7 changed files with 31 additions and 34 deletions

View File

@@ -178,7 +178,7 @@
{showArchiveIcon}
{asset}
{groupIndex}
on:click={() => assetClickHandler(asset, groupAssets, groupTitle)}
onClick={() => assetClickHandler(asset, groupAssets, groupTitle)}
on:select={() => assetSelectHandler(asset, groupAssets, groupTitle)}
on:mouse-event={() => assetMouseEventHandler(groupTitle, asset)}
selected={$selectedAssets.has(asset) || $assetStore.albumAssets.has(asset.id)}

View File

@@ -8,7 +8,7 @@
import { isSearchEnabled } from '$lib/stores/search.store';
import { featureFlags } from '$lib/stores/server-config.store';
import { deleteAssets } from '$lib/utils/actions';
import { shortcuts, type ShortcutOptions } from '$lib/utils/shortcut';
import { shortcuts, type ShortcutOptions, matchesShortcut } from '$lib/utils/shortcut';
import { formatGroupTitle, splitBucketIntoDateGroups } from '$lib/utils/timeline-util';
import type { AlbumResponseDto, AssetResponseDto } from '@immich/sdk';
import { DateTime } from 'luxon';
@@ -202,24 +202,24 @@
let shiftKeyIsDown = false;
const onKeyDown = (e: KeyboardEvent) => {
const onKeyDown = (event: KeyboardEvent) => {
if ($isSearchEnabled) {
return;
}
if (e.key == 'Shift') {
e.preventDefault();
if (matchesShortcut(event, { key: 'Shift' })) {
event.preventDefault();
shiftKeyIsDown = true;
}
};
const onKeyUp = (e: KeyboardEvent) => {
const onKeyUp = (event: KeyboardEvent) => {
if ($isSearchEnabled) {
return;
}
if (e.key == 'Shift') {
e.preventDefault();
if (matchesShortcut(event, { key: 'Shift' })) {
event.preventDefault();
shiftKeyIsDown = false;
}
};