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
2 changed files with 218 additions and 17 deletions

View file

@ -78,6 +78,11 @@ export interface BadgeProps {
* is an icon and a number, say.
*/
ariaLabel?: string;
/**
* A badge that is one choice of a few: whether it is the chosen one, said to a
* screen reader (`aria-pressed`). Its look already says it, by fill.
*/
pressed?: boolean;
}
export function Badge({
@ -92,13 +97,17 @@ export function Badge({
class: extraClass,
title,
ariaLabel,
pressed,
}: BadgeProps) {
// `disabled` alone still means "button, just not clickable right
// now" — see the prop's own doc above for why this can't just check
// `onClick`. Both the branch below and the interactive-styling class
// key off this one derived flag, not off `onClick` separately, so
// they can no longer drift apart the way they used to.
const interactive = Boolean(onClick) || Boolean(disabled);
// A `pressed` badge is a toggle, so it is a button even when it is the one
// already chosen and has nothing to do on a click.
const interactive =
Boolean(onClick) || Boolean(disabled) || pressed !== undefined;
const classes = [
"ui-badge",
`ui-badge-${tone}`,
@ -127,6 +136,7 @@ export function Badge({
onClick={onClick}
disabled={disabled}
aria-expanded={expanded}
aria-pressed={pressed}
aria-label={ariaLabel}
title={title}
>

View file

@ -238,3 +238,25 @@ export function GripIcon() {
</svg>
);
}
// An arrow pointing down at a line, for "scroll to the end". Same size and
// stroke as `ExpandIcon`.
export function ArrowDownIcon() {
return (
<svg
width="1.3em"
height="1.3em"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<line x1="12" y1="4" x2="12" y2="16" />
<polyline points="6 11 12 17 18 11" />
<line x1="5" y1="21" x2="19" y2="21" />
</svg>
);
}