diff --git a/web/src/lib/components/photos-page/asset-grid.svelte b/web/src/lib/components/photos-page/asset-grid.svelte index c707a3bb6c..b2ead89028 100644 --- a/web/src/lib/components/photos-page/asset-grid.svelte +++ b/web/src/lib/components/photos-page/asset-grid.svelte @@ -101,6 +101,12 @@ } }; + const focusElement = () => { + if (document.activeElement === document.body) { + element.focus(); + } + }; + $: shortcutList = (() => { if ($isSearchEnabled || $showAssetViewer) { return []; @@ -111,8 +117,8 @@ { shortcut: { key: '?', shift: true }, onShortcut: () => (showShortcuts = !showShortcuts) }, { shortcut: { key: '/' }, onShortcut: () => goto(AppRoute.EXPLORE) }, { shortcut: { key: 'A', ctrl: true }, onShortcut: () => selectAllAssets(assetStore, assetInteractionStore) }, - { shortcut: { key: 'PageUp' }, onShortcut: () => (element.scrollTop = 0) }, - { shortcut: { key: 'PageDown' }, onShortcut: () => (element.scrollTop = element.scrollHeight) }, + { shortcut: { key: 'PageDown' }, preventDefault: false, onShortcut: focusElement }, + { shortcut: { key: 'PageUp' }, preventDefault: false, onShortcut: focusElement }, ]; if ($isMultiSelectState) { @@ -406,7 +412,8 @@