Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: the terminal message box has a placeholder and a spinner instead of a label and a sent line

The label 'message <agent>' is the input's placeholder (the label stays for
screen readers). The send button shows a spinner over its label while the
request is pending and keeps its width, and the 'sent' line is gone: the box
empties when the message is held. Spinner is a component of its own now, used
by the button and the refresh picker.
This commit is contained in:
iris 2026-11-06 19:37:26 +01:00 • committed by mara
commit c37205e8f5
2 changed files with 103 additions and 51 deletions

View file

@ -45,3 +45,12 @@
box-sizing: border-box;
min-height: 2.75em;
}
/* A label that stays for assistive tech and is off the screen. */
.ui-form-field-label-hidden {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}

View file

@ -16,21 +16,27 @@ export function FormField({
label,
htmlFor,
labelId,
hideLabel = false,
children,
}: {
label: string;
htmlFor?: string;
labelId?: string;
/** Keep the label for assistive tech and take it off the screen, for a
* control whose placeholder says the same. */
hideLabel?: boolean;
children: ComponentChildren;
}) {
const labelClass =
"ui-form-field-label" + (hideLabel ? " ui-form-field-label-hidden" : "");
return (
<div class="ui-form-field">
{htmlFor !== undefined ? (
<label class="ui-form-field-label" for={htmlFor}>
<label class={labelClass} for={htmlFor}>
{label}
</label>
) : (
<span class="ui-form-field-label" id={labelId}>
<span class={labelClass} id={labelId}>
{label}
</span>
)}