feat(reader): chapter select dropdown for direct chapter jumps (0.51.0)
Adds a chapter `<select>` to the reader's top nav listing every chapter of the current manga, defaulting to the open chapter; picking another entry navigates straight to it without going back to the manga detail page. Options use the "Ch. N — Title" form to match the existing chapter tile and prev/next buttons in the reader bar. Covered by a new Playwright spec. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -459,6 +459,27 @@
|
||||
</a>
|
||||
|
||||
<div class="controls" role="group" aria-label="reader options">
|
||||
<label class="chapter-field">
|
||||
<span class="visually-hidden">Jump to chapter</span>
|
||||
<select
|
||||
class="chapter-select"
|
||||
value={chapter.id}
|
||||
onchange={(e) => {
|
||||
const target = (e.currentTarget as HTMLSelectElement).value;
|
||||
if (target && target !== chapter.id) {
|
||||
void goto(`/manga/${manga.id}/chapter/${target}`);
|
||||
}
|
||||
}}
|
||||
data-testid="reader-chapter-select"
|
||||
>
|
||||
{#each sortedChapters as c (c.id)}
|
||||
<option value={c.id}>
|
||||
Ch. {c.number}{c.title ? ` — ${c.title}` : ''}
|
||||
</option>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<div class="mode-toggle" role="radiogroup" aria-label="layout">
|
||||
<button
|
||||
type="button"
|
||||
@@ -801,7 +822,8 @@
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.gap-field select {
|
||||
.gap-field select,
|
||||
.chapter-select {
|
||||
height: 32px;
|
||||
padding: 0 var(--space-2);
|
||||
background: var(--surface);
|
||||
@@ -811,6 +833,13 @@
|
||||
font-size: var(--font-sm);
|
||||
}
|
||||
|
||||
/* Cap the chapter dropdown's resting width so long titles don't
|
||||
push the rest of the nav off-screen; the native control's
|
||||
expanded menu still shows full option text on focus. */
|
||||
.chapter-select {
|
||||
max-width: 16rem;
|
||||
}
|
||||
|
||||
.visually-hidden {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
|
||||
Reference in New Issue
Block a user