fix(web): memory viewer arrow navigation (#19400)

* fix(web): memory viewer jumps down on arrow keys

* fix pnpm lockfile

---------

Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
Yaros 2025-09-10 15:47:38 +02:00 committed by GitHub
parent e18e4c5962
commit 027dab1487
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 190 additions and 204 deletions

View file

@ -42,6 +42,7 @@
onReload?: (() => void) | undefined;
pageHeaderOffset?: number;
slidingWindowOffset?: number;
arrowNavigation?: boolean;
}
let {
@ -60,6 +61,7 @@
onReload = undefined,
slidingWindowOffset = 0,
pageHeaderOffset = 0,
arrowNavigation = true,
}: Props = $props();
let { isViewing: isViewerOpen, asset: viewingAsset, setAssetId } = assetViewingStore;
@ -306,8 +308,12 @@
{ shortcut: { key: '?', shift: true }, onShortcut: handleOpenShortcutModal },
{ shortcut: { key: '/' }, onShortcut: () => goto(AppRoute.EXPLORE) },
{ shortcut: { key: 'A', ctrl: true }, onShortcut: () => selectAllAssets() },
{ shortcut: { key: 'ArrowRight' }, preventDefault: false, onShortcut: focusNextAsset },
{ shortcut: { key: 'ArrowLeft' }, preventDefault: false, onShortcut: focusPreviousAsset },
...(arrowNavigation
? [
{ shortcut: { key: 'ArrowRight' }, preventDefault: false, onShortcut: focusNextAsset },
{ shortcut: { key: 'ArrowLeft' }, preventDefault: false, onShortcut: focusPreviousAsset },
]
: []),
];
if (assetInteraction.selectionActive) {