mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat: improve/refactor focus handling (#17796)
* feat: improve focus * test * lint * use modulus in loop
This commit is contained in:
parent
2e8a286540
commit
4b1ced439b
11 changed files with 92 additions and 129 deletions
|
|
@ -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 = () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue