fix(a11y): screen readers hear how long ago each sidebar chat was updated (#32851)

This commit is contained in:
G30 2026-10-21 15:37:59 -04:00 • committed by GitHub
parent 2a6e3c0197
commit dc45e3960d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,6 +16,8 @@
<script lang="ts">
import { toast } from 'svelte-sonner';
import dayjs, { getDayjsLocale } from '$lib/dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import type { ChatParticipant } from '$lib/apis/folders';
import { goto, invalidate, invalidateAll } from '$app/navigation';
import { onMount, getContext, createEventDispatcher, tick } from 'svelte';
@ -62,6 +64,8 @@
import { createMessagesList } from '$lib/utils';
import { getOutputText } from '$lib/components/chat/Messages/structuredOutput';
dayjs.extend(relativeTime);
const i18n = getContext('i18n');
const dispatch = createEventDispatcher();
@ -575,9 +579,20 @@
</div>
</div>
{#if updatedAt ?? createdAt}
<span class="sr-only">
{dayjs(((updatedAt ?? createdAt) as number) * 1000)
.locale(getDayjsLocale($i18n.language))
.fromNow()}
</span>
{/if}
<!-- Time ago indicator -->
{#if (updatedAt ?? createdAt) && !showInlineActions && !($mobile && !readonly)}
<div class="shrink-0 self-center text-[0.625rem] text-gray-400 dark:text-gray-500 pl-2">
<div
class="shrink-0 self-center text-[0.625rem] text-gray-400 dark:text-gray-500 pl-2"
aria-hidden="true"
>
{formatTimeAgo((updatedAt ?? createdAt) as number)}
</div>
{/if}