feat(shared-ui): add focusTrap action and apply to shared Modal

Create reusable Svelte action for focus trapping in modals/dialogs.
Traps Tab/Shift+Tab within element and restores focus on destroy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-24 10:04:04 +01:00
parent 8bc52f4264
commit c27f6f88f0
4 changed files with 75 additions and 0 deletions

View file

@ -2,6 +2,7 @@
import type { Snippet } from 'svelte';
import { X } from '@manacore/shared-icons';
import Text from '../atoms/Text.svelte';
import { focusTrap } from '../actions/focusTrap';
interface Props {
visible: boolean;
@ -60,6 +61,7 @@
role="dialog"
aria-modal="true"
tabindex="-1"
use:focusTrap
>
<!-- Modal Content -->
<!-- svelte-ignore a11y_no_static_element_interactions -->