mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 01:11:46 +03:00
feat: improve/refactor focus handling (#17796)
* feat: improve focus * test * lint * use modulus in loop
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { t } from 'svelte-i18n';
|
||||
import Button from './button.svelte';
|
||||
import { getTabbable } from '$lib/utils/focus-util';
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
@@ -23,7 +24,12 @@
|
||||
|
||||
const moveFocus = () => {
|
||||
const targetEl = document.querySelector<HTMLElement>(target);
|
||||
targetEl?.focus();
|
||||
if (targetEl) {
|
||||
const element = getTabbable(targetEl)[0];
|
||||
if (element) {
|
||||
element.focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const getBreakpoint = () => {
|
||||
|
||||
Reference in New Issue
Block a user