feat: add comment keybind navigation

This commit is contained in:
James Xylight committed 2025-08-07 21:21:23 -07:00
1 parent 0ca8f7474e
commit 7e2e7c513c
10 files changed
+152 -52

No files matched your search

@@ -4,6 +4,7 @@
import type { CommentNodeI } from './comments.svelte'
import Comments from './CommentTree.svelte'
import { onMount } from 'svelte'
import { keybindFeed } from '$lib/ui/keybinds.svelte'
interface Props {
nodes: CommentNodeI[]
@@ -13,8 +14,8 @@
onMount(() => {
if (scrollTo) {
const element = document?.getElementById(scrollTo)
setTimeout(() => {
const element = document?.getElementById(scrollTo)
element?.scrollIntoView({ behavior: 'smooth', block: 'start' })
}, 100)
}
@@ -38,6 +39,8 @@
let initialOffset = $derived(offsetEl?.offsetTop)
</script>
<svelte:body onkeydown={keybindFeed('li[data-type^="comment"]', 'start')} />
<div bind:this={offsetEl}>
{#if offsetEl}
<VirtualList