Make project and book covers accessible navigation links

This commit is contained in:
Nick Beckley 2026-11-03 20:26:59 +00:00
parent d6be496a93
commit 77332a25ab
6 changed files with 62 additions and 6 deletions

View File

@ -15,8 +15,8 @@
1. Completed: B1 ribbon order and regression coverage.
2. Completed: B2 compact Locations drag controls and PWA width.
3. In progress: B3 clickable project/book covers and titles.
4. B4 investigate and retire obsolete Phase 1 Checklist safely.
3. Completed: B3 clickable project/book covers and titles.
4. In progress: B4 investigate and retire obsolete Phase 1 Checklist safely.
5. C shared workspace resizing and maximisation, starting with Relationships reference.
6. D UX audit and repairs.
7. E functional reliability repairs.
@ -46,3 +46,9 @@ Replaced the standalone dropdown panel with compact Change parent / Create relat
Verification: solution build passed (0 warnings/errors); location browser regression passed, including keyboard activation, persistence, both drag modes, confirmation/cancellation, invalid targets, concurrent server rejection and scroll preservation. Repaired a stale fixture to read the shared confirmation partial, and explicitly scrolled the dragged source into view after toolbar keyboard use. Full harness rerun in progress.
B1 commit: 7f19319.
### B3 — Project and book cover navigation
Linked active project cover stacks and missing-cover initials to the same Projects/Details route as Open. Linked Project Overview book covers (including the default placeholder) to the existing Books/Details route. Existing titles already use those routes. Edit, Archive and More remain independent siblings. Added pointer, hover and visible keyboard focus treatment.
Verification: solution build passed; rendered Razor browser regression passed for real covers, missing covers, title/Open route equality, keyboard activation and focus in browser/PWA modes. Added isolated Projects listing data to the existing browser host. B2 full harness rerun passed (exit 0). B2 commit: d6be496.

View File

@ -0,0 +1,35 @@
const { chromium } = require('playwright');
const assert = require('node:assert/strict');
(async () => {
const browser = await chromium.launch({ executablePath: process.env.CHROMIUM_PATH });
try {
for (const standalone of [false, true]) {
const context = await browser.newContext({ viewport: { width: 1440, height: 1000 } });
if (standalone) await context.addInitScript(() => Object.defineProperty(navigator, 'standalone', { value: true }));
const page = await context.newPage();
for (const [surface, cardSelector, openLabel] of [['projects', '.project-card', 'Open'], ['dashboard', '.dashboard-book-card', 'Open Book']]) {
await page.goto(`http://127.0.0.1:5238/fixture?page=${surface}`);
const cards = page.locator(cardSelector);
assert.ok(await cards.count());
for (const card of await cards.all()) {
const cover = card.locator('a.cover-navigation');
const open = card.getByRole('link', { name: openLabel, exact: true });
const title = card.locator('h2 a, h3 a');
const href = await open.getAttribute('href');
assert.equal(await cover.getAttribute('href'), href);
assert.equal(await title.getAttribute('href'), href);
assert.equal(await cover.locator('a, button, form').count(), 0, 'No nested actions');
await cover.focus();
assert.equal(await cover.evaluate(node => node.matches(':focus-visible')), true);
assert.equal(await cover.evaluate(node => getComputedStyle(node).cursor), 'pointer');
await page.route('**' + href, route => route.fulfill({ body: '<p>Opened</p>' }));
await cover.press('Enter');
await page.waitForURL('**' + href);
await page.goBack();
}
}
await context.close();
}
console.log('PASS project/book covers, placeholders and titles share Open routes, keyboard focus and activation in browser/PWA');
} finally { await browser.close(); }
})().catch(error => { console.error(error); process.exitCode = 1; });

View File

@ -275,6 +275,17 @@ internal static class ToolbarBrowserHost
NeedsAttention = new() { Warnings = [new() { SeverityName = "Review", WarningTypeName = "Chronology", Message = "Check the order of events at the harbour.", LocationLabel = "Book 1 · Chapter 12" }] }
});
}
if (context.Request.Query["page"] == "projects")
{
route.Values["controller"] = "Projects";
route.Values["action"] = "Index";
surface = await Render("Projects/Index", new ProjectIndexViewModel {
ActiveProjects = [
new() { ProjectID = 7, ProjectName = "With cover", CoverThumbnailPaths = ["/images/placeholders/book-cover.svg"] },
new() { ProjectID = 8, ProjectName = "Without cover" }
]
});
}
var desktopPage = context.Request.Query["desktop"].ToString();
if (!string.IsNullOrEmpty(desktopPage))
{

View File

@ -133,12 +133,12 @@
<div class="col-12 col-xl-6 col-xxl-4">
<article data-pd-context="book" data-pd-context-id="@book.BookID" data-pd-context-label="@book.BookTitle" class="card h-100 overflow-hidden dashboard-book-card">
<div class="row g-0 h-100">
<div class="col-4 d-flex align-items-center justify-content-center" style="aspect-ratio:2 / 3; background:var(--plotline-soft);">
<a class="col-4 d-flex align-items-center justify-content-center cover-navigation" asp-controller="Books" asp-action="Details" asp-route-id="@book.BookID" aria-label="Open @book.BookTitle" style="aspect-ratio:2 / 3; background:var(--plotline-soft);">
<img src="@book.CoverThumbnailPath"
alt="Cover for @book.BookTitle"
class="img-fluid"
style="max-width:100%; max-height:100%; object-fit:contain;" />
</div>
</a>
<div class="col-8">
<div class="card-body h-100 d-flex flex-column">
<div class="d-flex align-items-start justify-content-between gap-2 mb-2">

View File

@ -149,7 +149,7 @@ else
@foreach (var project in Model.ActiveProjects)
{
<article data-pd-context="project" data-pd-context-id="@project.ProjectID" data-pd-context-label="@project.ProjectName" class="project-card">
<div class="project-card__visual">
<a class="project-card__visual cover-navigation" asp-action="Details" asp-route-id="@project.ProjectID" aria-label="Open @project.ProjectName">
@if (project.CoverThumbnailPaths.Any())
{
<div class="project-cover-stack" aria-label="Book covers for @project.ProjectName">
@ -168,7 +168,7 @@ else
<span>@Initials(project.ProjectName)</span>
</div>
}
</div>
</a>
<div class="project-card__body">
<div class="project-card__heading">
<div>

View File

@ -7648,3 +7648,7 @@ html[data-standalone="true"] .scene-workspace .scene-workspace-workbench { heigh
html[data-standalone="true"] .plotline-shell.location-workspace-shell {
max-width: none;
}
.cover-navigation { cursor: pointer; text-decoration: none; }
.cover-navigation:hover { filter: brightness(.94); }
.cover-navigation:focus-visible { outline: 3px solid var(--bs-primary); outline-offset: -3px; }