feat(ui): show a tooltip with the full text on truncated titles

Add an `overflowTooltip` Svelte action that sets a native `title` only when
an element is actually clipped (ellipsis or line-clamp), re-checking on
resize. Native title is keyboard/touch reachable and zero-dep, unlike a
hover-only popover. Applied to the clipped titles on MangaCard, BookmarkList,
HistoryList, and the Continue-reading shelf.

Unit tests cover the overflow decision and the set/clear/update behaviour;
an e2e verifies a real-browser truncated card title gets the tooltip while a
short one does not.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-07-04 21:08:14 +02:00
parent ad1689b818
commit f5692ea109
11 changed files with 189 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
<script lang="ts">
import { fileUrl } from '$lib/api/client';
import { chapterLabel } from '$lib/api/chapters';
import { overflowTooltip } from '$lib/actions/overflowTooltip';
import type { ReadProgressSummary } from '$lib/api/read_progress';
import IconButton from '$lib/components/IconButton.svelte';
import BookImage from '@lucide/svelte/icons/book-image';
@@ -96,7 +97,12 @@
{/if}
</a>
<div class="meta">
<a href="/manga/{p.manga_id}" class="title" data-testid="{testid}-title">
<a
href="/manga/{p.manga_id}"
class="title"
data-testid="{testid}-title"
use:overflowTooltip={p.manga_title}
>
{p.manga_title}
</a>
<span class="target">