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

+8 -16
View File
@@ -14,7 +14,6 @@
import type { PostView } from 'lemmy-js-client'
import type { ClassValue } from 'svelte/elements'
import PostBody from './PostBody.svelte'
import { keybindPost } from '$lib/ui/keybinds.svelte'
function getTagRule(tags: Tag[]): 'blur-sm' | 'hide' | undefined {
const tagContent = tags.map(t => t.content.toLowerCase())
@@ -29,9 +28,9 @@
return rule
}
function onclick(e: Event) {
function onClick(e: Event) {
const event = e as Event
const parent = document.getElementById(`item-${post.post.id.toString()}`)
const parent = document.getElementById(post.post.id.toString())
if (event.target == parent) {
goto(postLink(post.post))
@@ -80,8 +79,6 @@
admin: post.creator_is_admin,
moderator: post.creator_is_moderator,
})
let voteComponent = $state<{ castVote: (vote: number) => void }>()
</script>
<!--
@@ -99,11 +96,12 @@
view == 'cozy' && 'py-5 flex flex-col gap-2',
clazz,
]}
id="item-{post.post.id.toString()}"
{onclick}
id={post.post.id.toString()}
onclick={e => {
onClick(e)
}}
onkeydown={e => {
if (e.key === 'Enter') onclick(e)
keybindPost(e, post, voteComponent?.castVote)
if (e.key == 'Enter') onClick(e)
}}
tabindex="0"
{style}
@@ -160,13 +158,7 @@
/>
{/if}
{#if actions}
<PostActions
{onhide}
bind:voteComponent
bind:post
style="grid-area: actions;"
{view}
/>
<PostActions {onhide} bind:post style="grid-area: actions;" {view} />
{/if}
<div
class="absolute overflow-hidden inset-0
@@ -51,7 +51,7 @@
let loading = $state(false)
export const castVote = async (newVote: number) => {
const castVote = async (newVote: number) => {
if (!profile.current?.jwt) {
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
return
@@ -34,7 +34,6 @@
style?: string
onedit?: (post: PostView) => void
onhide?: (hide: boolean) => void
voteComponent?: { castVote: (vote: number) => void }
}
let {
@@ -42,7 +41,6 @@
view = 'cozy',
debug = $bindable(false),
style = '',
voteComponent = $bindable(),
onedit,
onhide,
}: Props = $props()
@@ -79,7 +77,7 @@
<footer
class={[
'flex flex-row gap-2 items-center shrink-0 text-slate-600 dark:text-zinc-300',
'flex flex-row gap-2 items-center shrink-0 text-slate-600 dark:text-zinc-400',
buttonHeight,
]}
class:flex-row-reverse={settings.posts.reverseActions}
@@ -91,7 +89,6 @@
bind:score={post.counts.score}
bind:upvotes={post.counts.upvotes}
bind:downvotes={post.counts.downvotes}
bind:this={voteComponent}
showCounts={profile.current?.user?.local_user_view?.local_user
?.show_scores ?? true}
/>
@@ -12,7 +12,6 @@
type PostFeedID,
} from '$lib/lemmy/postfeed.svelte'
import { settings } from '$lib/settings.svelte.js'
import { keybindFeed } from '$lib/ui/keybinds.svelte'
import type { PostView } from 'lemmy-js-client'
import { Button } from 'mono-svelte'
import { onDestroy, onMount, untrack } from 'svelte'
@@ -171,8 +170,6 @@
})
</script>
<svelte:body onkeydown={keybindFeed()} />
<ul class="flex flex-col list-none" bind:this={listEl}>
{#key posts}
{#if posts?.length == 0}
@@ -203,9 +200,10 @@
>
{#snippet item(row)}
<li
data-index={row}
style={row < 7 ? `--anim-delay: ${row * 50}ms` : ''}
class={[
'relative post-container px-3 sm:px-6 z-0',
'relative post-container px-3 sm:px-6',
row < 7 && 'pop-in opacity-0',
]}
>