From 997e9c5877501c304ac7611d2e8401abca29901e Mon Sep 17 00:00:00 2001 From: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Date: Fri, 15 Mar 2024 21:00:53 +0100 Subject: [PATCH] refactor(web): list navigation with keyboard (#7987) --- .../shared-components/change-location.svelte | 60 ++---------- web/src/lib/utils/list-navigation.ts | 32 ++++++ web/src/lib/utils/shortcut.ts | 11 ++- .../(user)/people/[personId]/+page.svelte | 98 ++++++------------- 4 files changed, 76 insertions(+), 125 deletions(-) create mode 100644 web/src/lib/utils/list-navigation.ts diff --git a/web/src/lib/components/shared-components/change-location.svelte b/web/src/lib/components/shared-components/change-location.svelte index 786e8721b5..bf5c4f5cfe 100644 --- a/web/src/lib/components/shared-components/change-location.svelte +++ b/web/src/lib/components/shared-components/change-location.svelte @@ -1,7 +1,7 @@ - -
-
(hideSuggestion = true)}> +
(hideSuggestion = true) }} + use:listNavigation={suggestionContainer} + > -
+
{#if !hideSuggestion} {#each suggestedPlaces as place, index}
{:else} - {#each suggestedPeople as person, index (person.id)} - - {/each} +
+ {#each suggestedPeople as person, index (person.id)} + + {/each} +
{/if}
{/if}