web: fix artifact, chat, attention and timeline accessibility findings
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
+19
-1
@@ -91,7 +91,25 @@
|
||||
align-items: start;
|
||||
cursor: pointer;
|
||||
}
|
||||
.chat-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
|
||||
/* M6: the session title/meta area is the button; the row is a plain container
|
||||
and the Chat actions menu is a sibling of this button. */
|
||||
.chat-session-button {
|
||||
grid-column: 1;
|
||||
grid-row: 1 / span 2;
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: none;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.chat-session-button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
|
||||
.chat-row .row-head { grid-column: 1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
||||
.chat-row .row-title { min-width: 0; }
|
||||
.chat-row .row-meta { grid-column: 1; }
|
||||
|
||||
+25
-1
@@ -45,7 +45,31 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
.timeline-row:last-child { border-bottom: 0; }
|
||||
.timeline-row:hover, .timeline-row:focus-visible { background: var(--surface-2); outline: none; }
|
||||
.timeline-row:hover { background: var(--surface-2); }
|
||||
.timeline-row:focus-visible {
|
||||
background: var(--surface-2);
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
/* Artifact tiles (M5): the tile itself is a native button and Copy link/Share
|
||||
are sibling controls. The grid is shared with the shell item, so the button
|
||||
reset stays scoped here rather than editing base.css. */
|
||||
.artifact-tile-wrap { position: relative; display: flex; }
|
||||
.artifact-tile-wrap > .artifact-tile {
|
||||
flex: 1 1 auto;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
appearance: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.artifact-tile-wrap > .artifact-tile:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
.artifact-tile-wrap .artifact-actions { z-index: 1; }
|
||||
.timeline-glyph { flex: none; width: 18px; text-align: center; font-size: 14px; line-height: 1.4; }
|
||||
.timeline-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
|
||||
.timeline-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
|
||||
|
||||
@@ -145,6 +145,12 @@ function renderAttentionSheet() {
|
||||
);
|
||||
|
||||
const body = h("div", { class: "attention-sheet-body" });
|
||||
// One count for the whole open sheet: only repeated labels need the run id
|
||||
// appended, so dismissing stays unambiguous without noisy names elsewhere.
|
||||
const labelCounts = new Map();
|
||||
for (const entry of entries) {
|
||||
labelCounts.set(entry.label, (labelCounts.get(entry.label) ?? 0) + 1);
|
||||
}
|
||||
if (entries.length === 0) {
|
||||
body.append(h("p", { class: "attention-empty", text: "Nothing needs you right now." }));
|
||||
} else {
|
||||
@@ -156,7 +162,7 @@ function renderAttentionSheet() {
|
||||
onclick: clearAttentionSheet,
|
||||
}),
|
||||
);
|
||||
for (const entry of entries) body.append(renderAttentionRow(entry));
|
||||
for (const entry of entries) body.append(renderAttentionRow(entry, labelCounts));
|
||||
}
|
||||
|
||||
const sheet = h("div", { class: "attention-sheet-panel", tabindex: "-1" }, head, body);
|
||||
@@ -165,8 +171,12 @@ function renderAttentionSheet() {
|
||||
}
|
||||
|
||||
/** One attention row: status icon, the two text lines, and a trailing Dismiss. */
|
||||
function renderAttentionRow(entry) {
|
||||
function renderAttentionRow(entry, labelCounts = null) {
|
||||
const glyphState = entry.kind === AttentionKind.Decision ? "waiting" : "failed";
|
||||
const repeated = (labelCounts?.get(entry.label) ?? 0) > 1;
|
||||
const dismissLabel = repeated
|
||||
? `Dismiss ${entry.label} (run ${entry.runId})`
|
||||
: `Dismiss ${entry.label}`;
|
||||
const open = h(
|
||||
"button",
|
||||
{
|
||||
@@ -191,8 +201,8 @@ function renderAttentionRow(entry) {
|
||||
const dismiss = h("button", {
|
||||
class: "attention-dismiss",
|
||||
type: "button",
|
||||
"aria-label": "Dismiss",
|
||||
title: "Dismiss",
|
||||
"aria-label": dismissLabel,
|
||||
title: dismissLabel,
|
||||
onclick: (event) => {
|
||||
// The trailing control must never activate the row it sits in.
|
||||
event.stopPropagation();
|
||||
|
||||
+46
-22
@@ -1498,24 +1498,39 @@ function fillChatRows(rows) {
|
||||
|
||||
const active = filtered.filter((session) => !session.closed);
|
||||
const closed = filtered.filter((session) => session.closed);
|
||||
// Titles are often repeated ("New chat"); compute the duplicates once so the
|
||||
// per-row actions name can include the session id only when it is needed.
|
||||
const duplicateTitles = duplicateChatTitles(filtered);
|
||||
const groups = groupSessionsByDirectory(active);
|
||||
if (groups.length > 1) {
|
||||
for (const group of groups) {
|
||||
rows.append(h("div", { class: "chat-group-header", text: directoryLabel(group.directory) }));
|
||||
for (const session of group.sessions) rows.append(renderChatRow(session));
|
||||
for (const session of group.sessions) rows.append(renderChatRow(session, duplicateTitles));
|
||||
}
|
||||
} else {
|
||||
for (const session of active) rows.append(renderChatRow(session));
|
||||
for (const session of active) rows.append(renderChatRow(session, duplicateTitles));
|
||||
}
|
||||
if (closed.length > 0) {
|
||||
rows.append(h("div", { class: "chat-group-header", text: CLOSED_SECTION_LABEL }));
|
||||
for (const session of closed) rows.append(renderChatRow(session));
|
||||
for (const session of closed) rows.append(renderChatRow(session, duplicateTitles));
|
||||
}
|
||||
if (state.chatError) {
|
||||
rows.append(h("div", { class: "chat-error muted", text: state.chatError }));
|
||||
}
|
||||
}
|
||||
|
||||
/** The titles shared by more than one rendered session, for unique action names. */
|
||||
function duplicateChatTitles(sessions) {
|
||||
const counts = new Map();
|
||||
for (const session of sessions) {
|
||||
const title = sessionTitle(session);
|
||||
counts.set(title, (counts.get(title) ?? 0) + 1);
|
||||
}
|
||||
return new Set(
|
||||
[...counts.entries()].filter(([, count]) => count > 1).map(([title]) => title),
|
||||
);
|
||||
}
|
||||
|
||||
function chatEmpty(message) {
|
||||
return h("div", { class: "empty" }, h("span", { class: "muted", text: message }));
|
||||
}
|
||||
@@ -1525,7 +1540,7 @@ function chatEmpty(message) {
|
||||
* activity badge word, the work-label meta line and the close/reopen action.
|
||||
* Every server string is set with textContent.
|
||||
*/
|
||||
function renderChatRow(session) {
|
||||
function renderChatRow(session, duplicateTitles = new Set()) {
|
||||
const open = state.chatActiveId === session.id;
|
||||
const thread = state.chatThreads.get(session.id) ?? null;
|
||||
const unseen =
|
||||
@@ -1537,23 +1552,28 @@ function renderChatRow(session) {
|
||||
});
|
||||
const activity = sessionActivity(thread?.running === true, unseen);
|
||||
const badge = sessionActivityBadge(activity, open);
|
||||
// The row is a plain container (M6): the session title/meta area is the native
|
||||
// button and the Chat actions control is its sibling, not a child.
|
||||
const row = h("div", {
|
||||
class: `row chat-row${open ? " selected" : ""}`,
|
||||
role: "button",
|
||||
tabindex: "0",
|
||||
"data-session": session.id,
|
||||
onclick: () => openChatSession(session.id),
|
||||
onkeydown: (event) => {
|
||||
// Only the row itself opens on Enter/Space; the Chat actions menu handles
|
||||
// its own keyboard activation (and must not double-fire).
|
||||
if (event.target !== event.currentTarget) return;
|
||||
if (event.key === "Enter" || event.key === " ") {
|
||||
event.preventDefault();
|
||||
openChatSession(session.id);
|
||||
}
|
||||
});
|
||||
// Keep background and programmatic clicks opening the session, but never
|
||||
// double-fire when a real control (session button or actions) was clicked.
|
||||
row.addEventListener("click", (event) => {
|
||||
const target = event.target;
|
||||
if (target instanceof Element && target.closest("button, a")) return;
|
||||
openChatSession(session.id);
|
||||
});
|
||||
const sessionButton = h("button", {
|
||||
class: "chat-session-button",
|
||||
type: "button",
|
||||
onclick: (event) => {
|
||||
event.stopPropagation();
|
||||
openChatSession(session.id);
|
||||
},
|
||||
});
|
||||
const head = h("div", { class: "row-head" });
|
||||
const head = h("span", { class: "row-head" });
|
||||
head.append(h("span", { class: "row-title chat-row-title", text: sessionTitle(session) }));
|
||||
const chip = sessionChipLabel(session);
|
||||
if (chip) head.append(h("span", { class: "chip chat-kind-chip", text: chip }));
|
||||
@@ -1566,14 +1586,14 @@ function renderChatRow(session) {
|
||||
),
|
||||
);
|
||||
}
|
||||
row.append(head);
|
||||
row.append(
|
||||
sessionButton.append(head);
|
||||
sessionButton.append(
|
||||
h("span", {
|
||||
class: "row-meta chat-row-meta",
|
||||
text: sessionMeta(session, sessionWorkLabel(session.busy === true, thread)),
|
||||
}),
|
||||
);
|
||||
row.append(renderChatActionsMenu(session));
|
||||
row.append(sessionButton, renderChatActionsMenu(session, duplicateTitles));
|
||||
return row;
|
||||
}
|
||||
|
||||
@@ -1695,18 +1715,22 @@ function renderChatCreate() {
|
||||
* Close chat… (open) or Reopen (closed), then Hide on this device. Closing is the
|
||||
* shared, server-side finish; hiding only affects this device and says so.
|
||||
*/
|
||||
function renderChatActionsMenu(session) {
|
||||
function renderChatActionsMenu(session, duplicateTitles = new Set()) {
|
||||
const wrap = h("div", { class: "chat-row-actions chat-menu-wrap" });
|
||||
const expanded = state.chatMenu === session.id;
|
||||
const title = sessionTitle(session);
|
||||
const actionLabel = duplicateTitles.has(title)
|
||||
? `${CHAT_ACTIONS_LABEL} for ${title} (${session.id})`
|
||||
: `${CHAT_ACTIONS_LABEL} for ${title}`;
|
||||
wrap.append(
|
||||
h("button", {
|
||||
class: "ghost chat-menu-button",
|
||||
type: "button",
|
||||
text: "⋯",
|
||||
"aria-label": CHAT_ACTIONS_LABEL,
|
||||
"aria-label": actionLabel,
|
||||
"aria-haspopup": "menu",
|
||||
"aria-expanded": expanded ? "true" : "false",
|
||||
title: CHAT_ACTIONS_LABEL,
|
||||
title: actionLabel,
|
||||
onclick: (event) => {
|
||||
event.stopPropagation();
|
||||
openChatMenu(session.id);
|
||||
|
||||
@@ -850,7 +850,14 @@ function renderArtifactTile(artifact, viewable, viewerIndexOf) {
|
||||
const kind = artifactKind(artifact.content_type, artifact.name);
|
||||
const media = kind === ArtifactKind.Image || kind === ArtifactKind.Video;
|
||||
const name = artifact.name || "(unnamed artifact)";
|
||||
const tile = h("div", { class: "artifact-tile clickable" });
|
||||
// The tile is the native control (M5): Enter/Space activate it for free, and
|
||||
// the Copy link / Share buttons are siblings in the wrapper, never children.
|
||||
const wrap = h("div", { class: "artifact-tile-wrap" });
|
||||
const tile = h("button", {
|
||||
class: "artifact-tile clickable",
|
||||
type: "button",
|
||||
"aria-label": `Open ${name}`,
|
||||
});
|
||||
const openViewer = () => {
|
||||
const at = viewerIndexOf.get(artifact.url);
|
||||
if (at != null) openArtifactViewer(viewable, at);
|
||||
@@ -864,7 +871,13 @@ function renderArtifactTile(artifact, viewable, viewerIndexOf) {
|
||||
tile.append(img);
|
||||
tile.addEventListener("click", openViewer);
|
||||
} else if (kind === ArtifactKind.Video) {
|
||||
tile.append(h("div", { class: "artifact-poster" }, h("span", { class: "artifact-play", text: "▶" })));
|
||||
tile.append(
|
||||
h(
|
||||
"div",
|
||||
{ class: "artifact-poster" },
|
||||
h("span", { class: "artifact-play", "aria-hidden": "true", text: "▶" }),
|
||||
),
|
||||
);
|
||||
tile.append(h("div", { class: "artifact-name", text: name }));
|
||||
tile.addEventListener("click", openViewer);
|
||||
} else {
|
||||
@@ -875,8 +888,8 @@ function renderArtifactTile(artifact, viewable, viewerIndexOf) {
|
||||
);
|
||||
tile.addEventListener("click", openTab);
|
||||
}
|
||||
tile.append(renderTileActions(resolved, media));
|
||||
return tile;
|
||||
wrap.append(tile, renderTileActions(resolved, media));
|
||||
return wrap;
|
||||
}
|
||||
|
||||
/** The compact per-tile actions: copy-link (non-media tiles) and share. */
|
||||
|
||||
Reference in New Issue
Block a user