feat: Enhance reader styling and accessibility with improved layout and focus indicators

This commit is contained in:
JB
2025-10-10 07:42:13 -07:00
parent e7408a06b8
commit 258c3549f7
+28 -1
View File
@@ -112,6 +112,23 @@
#reader { #reader {
flex: 1 1 auto; flex: 1 1 auto;
padding: 1.5rem;
overflow-y: auto;
overflow-x: hidden;
line-height: 1.6;
font-size: 1.05rem;
scroll-behavior: smooth;
}
#reader:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 4px;
}
#reader p,
#reader li,
#reader blockquote {
max-width: 60ch;
} }
.reader-footer { .reader-footer {
@@ -146,7 +163,7 @@
<button type="button" data-action="next">Next</button> <button type="button" data-action="next">Next</button>
</div> </div>
<div id="reader-container"> <div id="reader-container">
<div id="reader"></div> <div id="reader" tabindex="0"></div>
</div> </div>
<div class="reader-footer"> <div class="reader-footer">
{% if audio_url %} {% if audio_url %}
@@ -362,6 +379,16 @@
}); });
document.addEventListener('keydown', (event) => { document.addEventListener('keydown', (event) => {
if (event.defaultPrevented || event.altKey || event.metaKey || event.ctrlKey) {
return;
}
const target = event.target;
if (target instanceof HTMLElement) {
const tag = target.tagName.toLowerCase();
if (tag === 'input' || tag === 'textarea' || tag === 'select' || target.isContentEditable) {
return;
}
}
if (event.key === 'ArrowLeft') { if (event.key === 'ArrowLeft') {
if (currentIndex > 0) { if (currentIndex > 0) {
renderChapter(currentIndex - 1); renderChapter(currentIndex - 1);