mirror of
https://github.com/hcengineering/platform.git
synced 2025-03-22 15:45:14 +00:00
22 lines
424 B
Svelte
22 lines
424 B
Svelte
<script lang="ts">
|
|
import { FocusManager } from '../focus'
|
|
|
|
export let manager: FocusManager
|
|
export let isEnabled: boolean = true
|
|
|
|
function handleKey (evt: KeyboardEvent): void {
|
|
if (evt.code === 'Tab' && isEnabled) {
|
|
evt.preventDefault()
|
|
evt.stopPropagation()
|
|
manager.next(evt.shiftKey ? -1 : 1)
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<svelte:window
|
|
on:keydown={(evt) => {
|
|
handleKey(evt)
|
|
}}
|
|
/>
|
|
<slot />
|