Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: landmarks, a skip link, a page heading, named repeated buttons and a log role on the terminal

The shell now has a main landmark that takes the focus when a page opens, a skip link as the first Tab stop, a labelled nav, aria-current on the active tab, and a hidden h1 with the page's name (no page drew one). The tab close button and tab link get a visible focus ring and a larger target. Repeated edit, remove, delete, fire now, pause, duplicate buttons and the icon-only terminal, expand and close badges get a name that says what they act on (Button gains ariaLabel). A badge can be pressed (aria-pressed), used for the internet modes and the SSH target form, whose fake tablist is now a labelled group. The terminal is a focusable role=log with live announcements off, and a latest badge scrolls back to the newest row once the operator has scrolled up and the terminal has stopped following.
This commit is contained in:
iris 2026-11-19 18:49:10 +01:00 • committed by mara
commit c9e6cd2e61
10 changed files with 218 additions and 17 deletions

View file

@ -336,6 +336,7 @@ export function AgentInference({ agent }: { agent: string }) {
<Badge
variant="quiet"
value="edit"
ariaLabel={`edit ${agent}'s inference settings`}
title={`set the swarm's model, effort, subagent models, subagent cap and context limits for ${agent}`}
onClick={() => setEditing(true)}
/>

View file

@ -46,6 +46,7 @@ export function AgentInstructions({ agent }: { agent: string }) {
<Badge
variant="quiet"
value="edit"
ariaLabel={`edit ${agent}'s AGENTS.md`}
title={`read and change ${agent}'s AGENTS.md`}
onClick={() => setEditing(true)}
/>

View file

@ -149,6 +149,7 @@ export function AgentLimits({ agent }: { agent: string }) {
<Badge
variant="quiet"
value="edit"
ariaLabel={`edit ${agent}'s resource caps`}
title={`set the swarm's CPU and memory caps for ${agent}`}
onClick={() => setEditing(true)}
/>

View file

@ -280,6 +280,7 @@ export function AgentInternet({ agent, g }: { agent: string; g: GrantState }) {
<Badge
variant={m === mode ? "default" : "quiet"}
tone={m === mode ? "accent" : "neutral"}
pressed={m === mode}
value={label}
title={`${meaning} for ${agent}`}
disabled={busy}

View file

@ -139,12 +139,13 @@ export function AgentSsh({ agent, g }: { agent: string; g: GrantState }) {
<code>&lt;user&gt;</code> replaced by the account it logs in as.
The key is the swarm's CA, a public value.
</p>
<div role="tablist" aria-label="target kind">
<div role="group" aria-label="target kind">
{TARGET_FORMS.map(([f, label]) => (
<Badge
key={f}
variant={f === form ? "default" : "quiet"}
tone={f === form ? "accent" : "neutral"}
pressed={f === form}
value={label}
onClick={() => setForm(f)}
/>

View file

@ -109,6 +109,7 @@ export function AllowedDomains({ agent }: { agent: string }) {
<Badge
variant="quiet"
value="remove"
ariaLabel={`remove ${e.domain}`}
title={`stop allowing ${e.domain} for ${
e.agent === undefined ? "every agent" : agent
}`}

View file

@ -173,6 +173,7 @@ export function LinkedAccounts({
<Badge
variant="quiet"
value="delete"
ariaLabel={`delete the ${accountKindLabel(a.kind)} account ${a.name}`}
title={`delete the ${accountKindLabel(a.kind)} account ${a.name}`}
onClick={() => openDelete(a)}
/>

View file

@ -115,6 +115,7 @@ export function AgentCard({
<Badge
variant="quiet"
value={<TerminalIcon />}
ariaLabel={`open ${row.name}'s terminal`}
title={`open ${row.name}'s terminal in its own tab`}
onClick={() => openTab({ href: term.page, label: term.label })}
/>

View file

@ -14,6 +14,18 @@
padding-block-end: 4.8em;
}
/* The way back to the newest row, over the terminal's bottom-right corner,
above the message box where there is one. */
.ui-agent-term-preview-latest {
position: absolute;
right: 1.8em;
bottom: 1em;
z-index: 1;
}
.ui-agent-term-preview-with-input .ui-agent-term-preview-latest {
bottom: 5.4em;
}
.ui-agent-term-preview-wrap.terminal-wrap {
max-height: 18em;
}

View file

@ -22,7 +22,7 @@
import { useLayoutEffect, useRef, useState } from "preact/hooks";
import type { ComponentChildren } from "preact";
import { Badge } from "@hive/shared/badge.js";
import { ExpandIcon } from "@hive/shared/icons.js";
import { ArrowDownIcon, ExpandIcon } from "@hive/shared/icons.js";
import { Row } from "@hive/shared/term-row.js";
import { useDynamicTabs } from "../../shell/useDynamicTabs.js";
import {
@ -146,7 +146,18 @@ export function AgentTermPreview({
<div class="ui-agent-term-preview-trailing">{trailing}</div>
)}
</div>
<div class="live terminal" ref={logRef} onScroll={handleScroll}>
{/* A log, so a screen reader knows what it is; `aria-live="off"` as
rows can arrive many a second, and the operator reads them on
demand. Focusable, so the arrow keys scroll it. */}
<div
class="live terminal"
role="log"
aria-live="off"
aria-label={`${paths.label} terminal`}
tabIndex={0}
ref={logRef}
onScroll={handleScroll}
>
{rows.length === 0 ? (
<div class="row note">
{/* Explicit `.row-content` wrapper, not a bare text child —
@ -168,6 +179,17 @@ export function AgentTermPreview({
rows.map((row) => <Row key={row.key} row={row} />)
)}
</div>
{/* Scrolled up, the terminal stops following: this is the way back. */}
{!stickToBottom && rows.length > 0 && (
<div class="ui-agent-term-preview-latest">
<Badge
icon={<ArrowDownIcon />}
value="latest"
title="scroll to the newest row and follow it again"
onClick={() => setStickToBottom(true)}
/>
</div>
)}
</div>
{subagent === undefined && <AgentInputForm agentName={agentName} />}
</div>