mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-28 06:22:33 +00:00
fix(a11y): screen readers hear how long ago each sidebar chat was updated (#32851)
This commit is contained in:
parent
2a6e3c0197
commit
dc45e3960d
1 changed files with 16 additions and 1 deletions
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue