Skip to content

Commit

Permalink
fix: Lang toggle onClick behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
kiosion committed May 9, 2024
1 parent 9839501 commit c490114
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion svelte-app/src/components/controls/language-toggle.svelte
Expand Up @@ -16,7 +16,7 @@
const handleClick = (event: Event, lang: (typeof APP_LANGS)[number]) => {
event.preventDefault();
if ($page?.url?.pathname?.startsWith(`/${lang}`) || !get(isMobile)) {
if ($page?.url?.pathname?.startsWith(`/${lang}`)) {
return Promise.resolve();
}
Expand Down Expand Up @@ -79,9 +79,11 @@
on:mouseleave={handleHide}
on:blur={handleBlur}
on:click={(e) =>
get(isMobile) &&
handleClick(e, $currentLang === APP_LANGS[0] ? APP_LANGS[1] : APP_LANGS[0])}
on:keyup={(e) =>
e.key === 'Enter' &&
get(isMobile) &&
handleClick(e, $currentLang === APP_LANGS[0] ? APP_LANGS[1] : APP_LANGS[0])}
role="menu"
aria-label="Change language"
Expand Down

0 comments on commit c490114

Please sign in to comment.