Revert "feat: add customizable keyboard navigation"

This commit is contained in:
Xylight authored and GitHub committed 2025-08-15 06:31:23 -07:00
1 parent 4e7c37bd89
commit f9a6e775f3
17 files changed
+39 -306

No files matched your search

@@ -25,7 +25,6 @@
import CommentForm from './CommentForm.svelte'
import type { CommentNodeI } from './comments.svelte'
import { page } from '$app/state'
import { keybindComment } from '$lib/ui/keybinds.svelte'
import { settings } from '$lib/settings.svelte'
interface Props {
@@ -119,15 +118,9 @@
</Modal>
{/if}
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
<li
class={['py-3 relative focus:outline-0', clazz]}
class={['py-3 relative', clazz]}
id={node.comment_view.comment.id.toString()}
data-type="comment"
onkeydown={e =>
keybindComment(e, node.comment_view.comment.id, () => (open = !open))}
tabindex="0"
>
{#if meta}
<button
@@ -29,7 +29,6 @@
replying?: boolean
disabled?: boolean
onedit?: (comment: CommentView) => void
voteComponent?: { castVote: (vote: number) => void }
}
let {
@@ -37,7 +36,6 @@
replying = $bindable(false),
disabled = false,
onedit,
voteComponent,
}: Props = $props()
</script>
@@ -50,7 +48,6 @@
downvotes={comment.counts.downvotes}
vote={comment.my_vote}
commentId={comment.comment.id}
bind:this={voteComponent}
/>
<Button
size="sm"
@@ -76,7 +73,7 @@
class="text-slate-600 dark:text-zinc-400"
>
{#snippet prefix()}
<Icon src={EllipsisHorizontal} size="16" micro />
<Icon src={EllipsisHorizontal} width={16} height={16} mini />
{/snippet}
</Button>
{/snippet}
@@ -4,7 +4,6 @@
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[]
@@ -14,8 +13,8 @@
onMount(() => {
if (scrollTo) {
const element = document?.getElementById(scrollTo)
setTimeout(() => {
const element = document?.getElementById(scrollTo)
element?.scrollIntoView({ behavior: 'smooth', block: 'start' })
}, 100)
}
@@ -39,8 +38,6 @@
let initialOffset = $derived(offsetEl?.offsetTop)
</script>
<svelte:body onkeydown={keybindFeed('li[data-type^="comment"]', 'start')} />
<div bind:this={offsetEl}>
{#if offsetEl}
<VirtualList
@@ -2,7 +2,7 @@
import { profile } from '$lib/auth.svelte.js'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import { t } from '$lib/i18n/translations'
import { client } from '$lib/lemmy.svelte'
import { getClient } from '$lib/lemmy.svelte'
import { buttonColor, toast } from 'mono-svelte'
import { ChevronDown, ChevronUp, Icon } from 'svelte-hero-icons'
import { backOut } from 'svelte/easing'
@@ -24,37 +24,18 @@
commentId,
}: Props = $props()
export const castVote = async (newVote: number) => {
const castVote = async (newVote: number) => {
if (!profile.current?.jwt) {
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
return
}
switch (vote ?? 0) {
case 0:
// nothing was removed
if (newVote == 1) upvotes++
else downvotes++
break
case 1:
// removed an upvote
upvotes--
if (newVote == -1) downvotes++
break
case -1:
// removed a downvote
downvotes--
if (newVote == 1) upvotes++
break
}
vote = newVote
client()
.likeComment({
comment_id: commentId,
score: vote,
})
.then(res => ({ upvotes, downvotes } = res.comment_view.counts))
const res = await getClient().likeComment({
comment_id: commentId,
score: vote,
})
;({ upvotes, downvotes } = res.comment_view.counts)
}
let voteRatio = $derived(