mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00:00
fix(web): fix asset grid keyboard navigation (#9448)
* fix(web): fix asset grid keyboard navigation * Ignore eslint rule * Pass page up/down keys after focusing on grid * Remove unneeded event listener, use existing class
This commit is contained in:
parent
602f0a3499
commit
847cb90038
1 changed files with 10 additions and 3 deletions
|
@ -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 @@
|
|||
<!-- Right margin MUST be equal to the width of immich-scrubbable-scrollbar -->
|
||||
<section
|
||||
id="asset-grid"
|
||||
class="scrollbar-hidden h-full overflow-y-auto pb-[60px] {isEmpty ? 'm-0' : 'ml-4 tall:ml-0 mr-[60px]'}"
|
||||
class="scrollbar-hidden h-full overflow-y-auto outline-none pb-[60px] {isEmpty ? 'm-0' : 'ml-4 tall:ml-0 mr-[60px]'}"
|
||||
tabindex="-1"
|
||||
bind:clientHeight={viewport.height}
|
||||
bind:clientWidth={viewport.width}
|
||||
bind:this={element}
|
||||
|
|
Loading…
Reference in a new issue