feat: improve/refactor focus handling (#17796)

* feat: improve focus

* test

* lint

* use modulus in loop
This commit is contained in:
Min Idzelis 2025-04-30 00:19:38 -04:00 committed by GitHub
parent 2e8a286540
commit 4b1ced439b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 92 additions and 129 deletions

View file

@ -2,7 +2,7 @@
import Icon from '$lib/components/elements/icon.svelte';
import type { AssetStore, LiteBucket } from '$lib/stores/assets-store.svelte';
import { mobileDevice } from '$lib/stores/mobile-device.svelte';
import { getFocusable } from '$lib/utils/focus-util';
import { getTabbable } from '$lib/utils/focus-util';
import { fromLocalDateTime, type ScrubberListener } from '$lib/utils/timeline-util';
import { mdiPlay } from '@mdi/js';
import { clamp } from 'lodash-es';
@ -376,7 +376,7 @@
if (forward || backward) {
event.preventDefault();
const focusable = getFocusable(document);
const focusable = getTabbable(document.body);
if (scrollBar) {
const index = focusable.indexOf(scrollBar);
if (index !== -1) {