diff options
| author | elioat <{ID}+{username}@users.noreply.github.com> | 2025-09-30 09:50:34 -0400 |
|---|---|---|
| committer | elioat <{ID}+{username}@users.noreply.github.com> | 2025-09-30 09:50:34 -0400 |
| commit | 91c98254f477726372c8bcb1068afbe6aec90120 (patch) | |
| tree | 5131e77cc768c097774efaa34fb107ed24c7111c /html | |
| parent | dd79baacf8dcaaea21d3b11c104677e344f49c4d (diff) | |
| download | tour-91c98254f477726372c8bcb1068afbe6aec90120.tar.gz | |
*
Diffstat (limited to 'html')
| -rw-r--r-- | html/rtb/public/about.html | 22 | ||||
| -rw-r--r-- | html/rtb/public/app.js | 85 | ||||
| -rw-r--r-- | html/rtb/public/index.html | 5 | ||||
| -rw-r--r-- | html/rtb/public/styles.css | 57 |
4 files changed, 122 insertions, 47 deletions
diff --git a/html/rtb/public/about.html b/html/rtb/public/about.html index 2e171f8..102525e 100644 --- a/html/rtb/public/about.html +++ b/html/rtb/public/about.html @@ -3,25 +3,27 @@ <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>About Read the Book</title> + <title>About Read the Book - Digital Reading Platform</title> + <meta name="description" content="Learn about Read the Book, a digital reading platform that presents classic literature in small, digestible chunks."> <link rel="stylesheet" href="styles.css"> </head> <body> - <div class="about-container"> - <div class="about-reading-view"> - <div class="about-text"> + <main class="about-container"> + <header class="about-reading-view"> + <h1 class="sr-only">About Read the Book</h1> + <section class="about-text"> <p>I felt myself falling into bad habits.</p> <p>This project is meant to replace doom scrolling and encourage reading books by presenting them in really tiny digestible parts.</p> - <p>All the books are from the <a href="https://gutenberg.org/">public domain</a>.</p> - </div> + <p>All the books are from the <a href="https://gutenberg.org/" target="_blank" rel="noopener noreferrer">public domain</a>.</p> + </section> - <div class="about-controls"> + <nav class="about-controls"> <a href="index.html" class="back-link">Back to Reading</a> - </div> - </div> - </div> + </nav> + </header> + </main> <script> // Simple dark mode application for about page diff --git a/html/rtb/public/app.js b/html/rtb/public/app.js index db91289..8b0a100 100644 --- a/html/rtb/public/app.js +++ b/html/rtb/public/app.js @@ -304,7 +304,7 @@ function render(model) { applyDarkMode(model); if (model.view === 'loading') { - app.innerHTML = '<div class="loading">Loading...</div>'; + app.innerHTML = '<div class="loading" role="status" aria-live="polite">Loading books...</div>'; return; } @@ -323,31 +323,47 @@ function render(model) { return ` <li class="book-item" data-book-id="${book.id}"> - <div class="book-title">${book.title}</div> - <div class="book-author">by ${book.author}</div> - ${progress ? `<div class="book-progress">${percentage}% complete</div>` : ''} + <button class="book-button" type="button"> + <div class="book-title">${book.title}</div> + <div class="book-author">by ${book.author}</div> + ${progress ? `<div class="book-progress">${percentage}% complete</div>` : ''} + </button> </li> `; }).join(''); app.innerHTML = ` - <div class="header"> + <header class="header"> <h1>Read the Book</h1> - <select id="dark-mode-select" class="dark-mode-select" title="Choose dark mode preference"> + <label for="dark-mode-select" class="sr-only">Choose dark mode preference</label> + <select id="dark-mode-select" class="dark-mode-select"> <option value="auto" ${model.darkMode === null ? 'selected' : ''}>🌓 Auto</option> <option value="light" ${model.darkMode === false ? 'selected' : ''}>☀️ Light</option> <option value="dark" ${model.darkMode === true ? 'selected' : ''}>🌙 Dark</option> </select> - </div> - ${model.error ? `<div class="error">${model.error}</div>` : ''} - <ul class="book-list">${bookItems}</ul> - <footer><p><a href="about.html">About</a></p></footer> + </header> + ${model.error ? `<div class="error" role="alert">${model.error}</div>` : ''} + <main> + <h2 class="sr-only">Available Books</h2> + <ul class="book-list">${bookItems}</ul> + </main> + <footer> + <p><a href="about.html">About Read the Book</a></p> + </footer> `; - document.querySelectorAll('.book-item').forEach(item => { - item.addEventListener('click', () => { - const bookId = item.getAttribute('data-book-id'); + document.querySelectorAll('.book-button').forEach(button => { + const handleBookSelection = () => { + const bookId = button.closest('.book-item').getAttribute('data-book-id'); dispatch({ type: 'SelectBook', bookId }); + }; + + button.addEventListener('click', handleBookSelection); + button.addEventListener('keydown', (e) => { + if (e.key === 'Enter' || e.key === ' ') { + e.preventDefault(); + handleBookSelection(); + } }); }); @@ -371,22 +387,27 @@ function render(model) { const canGoForward = model.currentSentence < book.totalSentences - SENTENCES_PER_PAGE; app.innerHTML = ` - <div class="reading-view"> - ${model.error ? `<div class="error">${model.error}</div>` : ''} - <div class="reading-text"> - ${model.currentSentences.join(' ')} - </div> - <div class="controls"> + <main class="reading-view"> + ${model.error ? `<div class="error" role="alert">${model.error}</div>` : ''} + <article class="reading-content"> + <h1 class="sr-only">Reading: ${book.title}</h1> + <div class="reading-text"> + ${model.currentSentences.join(' ')} + </div> + </article> + <nav class="controls"> <button class="secondary" id="back" ${!canGoBack ? 'disabled' : ''}>← Back</button> <button id="next" ${!canGoForward ? 'disabled' : ''}>Next →</button> - </div> - <div class="progress-info"> + </nav> + <div class="progress-info" role="status" aria-live="polite"> ${book.title} — ${progress}% complete </div> - <button class="secondary" id="select-another" style="margin-top: 2rem;"> - Choose a Different Book - </button> - </div> + <nav class="book-selection"> + <button class="secondary" id="select-another" style="margin-top: 2rem;"> + Choose a Different Book + </button> + </nav> + </main> `; const backBtn = document.getElementById('back'); @@ -412,13 +433,15 @@ function render(model) { const book = getBook(model, model.currentBookId); app.innerHTML = ` - <div class="completed-view"> - <h2>The End!</h2> + <main class="completed-view"> + <h1>The End!</h1> <p>You've finished <em>${book ? book.title : 'this book'}</em></p> - <button id="select-another" style="margin-top: 2rem;"> - Choose A New Book - </button> - </div> + <nav> + <button id="select-another" style="margin-top: 2rem;"> + Choose A New Book + </button> + </nav> + </main> `; document.getElementById('select-another').addEventListener('click', () => { diff --git a/html/rtb/public/index.html b/html/rtb/public/index.html index 16a1b30..b46bd5f 100644 --- a/html/rtb/public/index.html +++ b/html/rtb/public/index.html @@ -3,11 +3,12 @@ <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>Read the Book</title> + <title>Read the Book - Digital Reading Platform</title> + <meta name="description" content="Read classic literature in small, digestible chunks. Build a consistent reading habit with 3-sentence pages."> <link rel="stylesheet" href="styles.css"> </head> <body> - <div id="app"></div> + <main id="app" role="main" aria-label="Read the Book application"></main> <script type="module" src="app.js"></script> </body> </html>
\ No newline at end of file diff --git a/html/rtb/public/styles.css b/html/rtb/public/styles.css index 1f02622..4a47690 100644 --- a/html/rtb/public/styles.css +++ b/html/rtb/public/styles.css @@ -50,6 +50,19 @@ body { transition: background-color 0.3s ease, color 0.3s ease; } +/* Screen reader only content */ +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + footer { text-align: center; margin-top: 2rem; @@ -86,18 +99,36 @@ h2 { } .book-item { - padding: 1.5rem; margin-bottom: 1rem; +} + +.book-button { + width: 100%; + padding: 1.5rem; background: var(--bg-secondary); + border: none; border-radius: 8px; box-shadow: var(--shadow); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; + text-align: left; + font-family: inherit; +} + +.book-button:hover { + transform: translateY(-1px); + box-shadow: 0 2px 4px rgba(0,0,0,0.05); + background: rgba(255, 255, 255, 0.1); +} + +.dark-mode .book-button:hover { + box-shadow: 0 2px 4px rgba(0,0,0,0.15); + background: rgba(255, 255, 255, 0.05); } -.book-item:hover { - transform: translateY(-2px); - box-shadow: var(--shadow-hover); +.book-button:focus { + outline: 2px solid var(--button-primary); + outline-offset: 2px; } .book-title { @@ -274,4 +305,22 @@ button.secondary:hover:not(:disabled) { .back-link:hover { background: var(--button-primary-hover); +} + +/* Link styles */ +a { + color: var(--button-primary); + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +a:visited { + color: var(--text-secondary); +} + +.dark-mode a:visited { + color: var(--text-muted); }
\ No newline at end of file |