Fix PDF loading overlay disappearing too early
All checks were successful
Test / test (push) Successful in 18s
Build and push Docker image / build (push) Successful in 14s

Moved overlay out of contentEl (which renderPdf clears immediately)
into the reader-overlay element. It now stays visible for the entire
render duration and is removed only after renderPdf resolves.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
marwin 2026-04-05 18:29:46 +02:00
parent d607388bad
commit b6619f6465
2 changed files with 7 additions and 3 deletions

View file

@ -1693,13 +1693,13 @@ body.reader-immersive.reader-show-bottom .reader-overlay { bottom: var(--bar-h)
/* PDF loading overlay */ /* PDF loading overlay */
.pdf-loading-overlay { .pdf-loading-overlay {
position: absolute; position: fixed;
inset: 0; inset: 0;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: rgba(20, 20, 20, 0.85); background: rgba(20, 20, 20, 0.85);
z-index: 10; z-index: 200;
} }
.pdf-loading-spinner { .pdf-loading-spinner {
width: 36px; width: 36px;

View file

@ -3149,8 +3149,12 @@ async function openBook(bookId) {
if (isPdfBook) { if (isPdfBook) {
currentPdfDoc = null; // reset so renderPdf creates fresh doc currentPdfDoc = null; // reset so renderPdf creates fresh doc
contentEl.innerHTML = '<div class="pdf-loading-overlay"><span class="pdf-loading-spinner"></span></div>'; const loadingEl = document.createElement('div');
loadingEl.className = 'pdf-loading-overlay';
loadingEl.innerHTML = '<span class="pdf-loading-spinner"></span>';
overlay.appendChild(loadingEl);
const result = await renderPdf(plain, contentEl); const result = await renderPdf(plain, contentEl);
loadingEl.remove();
title = result.title || title; title = result.title || title;
author = result.author || author; author = result.author || author;
toc = result.toc; toc = result.toc;