Skip to content

Commit cc806f2

Browse files
Copilot0xrinegade
andcommitted
Add accessibility improvements and final polish to book integration
Co-authored-by: 0xrinegade <[email protected]>
1 parent 180fea9 commit cc806f2

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

frontend/public/docs.html

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@
259259
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
260260
}
261261

262+
.book-nav-btn:focus {
263+
outline: 2px solid #525252;
264+
outline-offset: 2px;
265+
}
266+
262267
.book-nav-btn.prev {
263268
text-align: left;
264269
}
@@ -313,11 +318,13 @@
313318

314319
<main class="main-container py-8">
315320
<div class="flex flex-col md:flex-row">
316-
<div id="sidebar" class="mb-6 md:mb-0">
321+
<aside id="sidebar" class="mb-6 md:mb-0" role="navigation" aria-label="Documentation navigation">
317322
<h2 class="text-xl font-bold mb-4">Documentation</h2>
318-
<ul id="doc-nav" class="space-y-2"></ul>
319-
</div>
320-
<div id="content" class="flex-grow">
323+
<nav>
324+
<ul id="doc-nav" class="space-y-2" role="menu"></ul>
325+
</nav>
326+
</aside>
327+
<div id="content" class="flex-grow" role="main" aria-label="Documentation content">
321328
<div id="markdown-content" class="prose max-w-none"></div>
322329
</div>
323330
</div>
@@ -377,8 +384,9 @@ <h2 class="text-xl font-bold mb-4">Documentation</h2>
377384
const a = document.createElement('a');
378385
a.href = `#${doc.id}`;
379386
a.dataset.path = doc.path;
380-
a.className = 'block p-2 hover:bg-neutral-200 rounded';
387+
a.className = 'block p-2 hover:bg-neutral-200 rounded focus:outline-none focus:ring-2 focus:ring-neutral-400';
381388
a.innerText = doc.name;
389+
a.setAttribute('role', 'menuitem');
382390
a.addEventListener('click', (e) => {
383391
e.preventDefault();
384392
loadMarkdown(doc.path);
@@ -402,8 +410,9 @@ <h2 class="text-xl font-bold mb-4">Documentation</h2>
402410
a.href = `#${chapter.id}`;
403411
a.dataset.path = chapter.path;
404412
a.dataset.chapter = chapter.chapter;
405-
a.className = 'block p-2 hover:bg-neutral-200 rounded book-chapter';
413+
a.className = 'block p-2 hover:bg-neutral-200 rounded book-chapter focus:outline-none focus:ring-2 focus:ring-neutral-400';
406414
a.innerText = chapter.name;
415+
a.setAttribute('role', 'menuitem');
407416
a.addEventListener('click', (e) => {
408417
e.preventDefault();
409418
loadBookChapter(chapter);
@@ -509,7 +518,7 @@ <h2 class="font-bold">Error Loading Book Chapter</h2>
509518

510519
if (prevChapter) {
511520
navigation += `
512-
<button class="book-nav-btn prev" onclick="navigateToChapter('${prevChapter.id}')">
521+
<button class="book-nav-btn prev" onclick="navigateToChapter('${prevChapter.id}')" aria-label="Previous chapter: ${prevChapter.name}">
513522
${prevChapter.name}
514523
</button>
515524
`;
@@ -519,7 +528,7 @@ <h2 class="font-bold">Error Loading Book Chapter</h2>
519528

520529
if (nextChapter) {
521530
navigation += `
522-
<button class="book-nav-btn next" onclick="navigateToChapter('${nextChapter.id}')">
531+
<button class="book-nav-btn next" onclick="navigateToChapter('${nextChapter.id}')" aria-label="Next chapter: ${nextChapter.name}">
523532
${nextChapter.name}
524533
</button>
525534
`;

0 commit comments

Comments
 (0)