fix: focus trap expandable image
This commit is contained in:
1 parent
0bd9631fc0
commit
126b8c058e
1 file changed
+5
@@ -14,6 +14,7 @@
|
|||||||
import { Icon, XMark } from 'svelte-hero-icons'
|
import { Icon, XMark } from 'svelte-hero-icons'
|
||||||
import { backOut, expoOut } from 'svelte/easing'
|
import { backOut, expoOut } from 'svelte/easing'
|
||||||
import { fade, scale } from 'svelte/transition'
|
import { fade, scale } from 'svelte/transition'
|
||||||
|
import { focusTrap } from 'svelte-focus-trap'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The full-resolution image URL
|
* The full-resolution image URL
|
||||||
@@ -31,6 +32,10 @@
|
|||||||
flex flex-col z-[200] overscroll-contain"
|
flex flex-col z-[200] overscroll-contain"
|
||||||
transition:fade={{ duration: 150 }}
|
transition:fade={{ duration: 150 }}
|
||||||
on:click={() => history.back()}
|
on:click={() => history.back()}
|
||||||
|
on:keydown={(e) => {
|
||||||
|
if (e.key == 'Escape') history.back()
|
||||||
|
}}
|
||||||
|
use:focusTrap
|
||||||
>
|
>
|
||||||
<Button size="square-md" class="fixed z-[110] top-0 right-0 m-4">
|
<Button size="square-md" class="fixed z-[110] top-0 right-0 m-4">
|
||||||
<Icon src={XMark} size="16" mini slot="prefix" />
|
<Icon src={XMark} size="16" mini slot="prefix" />
|
||||||
|
|||||||
Reference in new issue
Block a user