mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
* chore(deps): update dependency eslint-plugin-svelte to v3 * chore: linting * chore: rebase --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Dietzler <mail@ddietzler.dev> Co-authored-by: Zack Pollard <zackpollard@ymail.com>
33 lines
768 B
Svelte
33 lines
768 B
Svelte
<script lang="ts">
|
|
import { t } from 'svelte-i18n';
|
|
import Button from './button.svelte';
|
|
|
|
interface Props {
|
|
/**
|
|
* Target for the skip link to move focus to.
|
|
*/
|
|
target?: string;
|
|
text?: string;
|
|
}
|
|
|
|
let { target = 'main', text = $t('skip_to_content') }: Props = $props();
|
|
|
|
let isFocused = $state(false);
|
|
|
|
const moveFocus = () => {
|
|
const targetEl = document.querySelector<HTMLElement>(target);
|
|
targetEl?.focus();
|
|
};
|
|
</script>
|
|
|
|
<div class="absolute z-50 top-2 left-2 transition-transform {isFocused ? 'translate-y-0' : '-translate-y-10 sr-only'}">
|
|
<Button
|
|
size="sm"
|
|
rounded="none"
|
|
onclick={moveFocus}
|
|
onfocus={() => (isFocused = true)}
|
|
onblur={() => (isFocused = false)}
|
|
>
|
|
{text}
|
|
</Button>
|
|
</div>
|