fix(ui): combobox pattern for the slash palette, named palette input, bound labels (#1753)
The composer textarea is now role=combobox with aria-expanded, aria-controls and aria-activedescendant wired to the slash palette's listbox ids. CommandInput has an accessible name. FieldLabels without a control beside them are bound: for/id on selects, inputs, switches and duration inputs across channels, curators and schedules pages, and role=group + aria-labelledby/aria-label on the TagsInput, secret-ref and rule row groups.
This commit is contained in:
9 files changed
+45
-37
No files matched your search
@@ -36,8 +36,8 @@ function asOp(value: unknown): PayloadCondition["op"] {
|
||||
<template>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label>Headers</Label>
|
||||
<div
|
||||
<Label id="rule-headers-label">Headers</Label>
|
||||
<div role="group" aria-labelledby="rule-headers-label"
|
||||
v-for="(h, i) in rule.headers || []"
|
||||
:key="`h${i}`"
|
||||
class="flex items-center gap-2"
|
||||
@@ -69,8 +69,8 @@ function asOp(value: unknown): PayloadCondition["op"] {
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
<Label>Payload</Label>
|
||||
<div
|
||||
<Label id="rule-payload-label">Payload</Label>
|
||||
<div role="group" aria-labelledby="rule-payload-label"
|
||||
v-for="(p, i) in rule.payload || []"
|
||||
:key="`p${i}`"
|
||||
class="flex flex-wrap items-center gap-2"
|
||||
|
||||
@@ -177,9 +177,10 @@ function setModels(list: string[]) {
|
||||
<FieldGroup v-if="form && shown(channel.id) && channel.id === 'telegram'" class="@container/field-group">
|
||||
<form.Field v-if="!instance" v-slot="{ field }" name="agent">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel>Runs as</FieldLabel></FieldContent>
|
||||
<FieldContent><FieldLabel for="channel-agent">Runs as</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<OptionSelect
|
||||
id="channel-agent"
|
||||
:model-value="field.state.value"
|
||||
:options="agentOptions"
|
||||
aria-label="Agent"
|
||||
@@ -194,34 +195,34 @@ function setModels(list: string[]) {
|
||||
<form.Field v-if="instance" v-slot="{ field }" name="telegram.token_ref">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent>
|
||||
<FieldLabel>Bot token</FieldLabel>
|
||||
<FieldLabel for="tg-token-field">Bot token</FieldLabel>
|
||||
<FieldDescription>Empty disables Telegram.</FieldDescription>
|
||||
</FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<SecretRefField :model-value="field.state.value" id-prefix="tg-token" @update:model-value="field.handleChange" />
|
||||
<div id="tg-token-field" role="group" aria-label="Bot token" class="contents"><SecretRefField :model-value="field.state.value" id-prefix="tg-token" @update:model-value="field.handleChange" /></div>
|
||||
</div>
|
||||
</Field>
|
||||
</form.Field>
|
||||
<Field orientation="responsive">
|
||||
<FieldContent>
|
||||
<FieldLabel>Allowed users</FieldLabel>
|
||||
<FieldLabel id="channel-allowed-label">Allowed users</FieldLabel>
|
||||
<FieldDescription>Everyone else is ignored.</FieldDescription>
|
||||
</FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<TagsInput :model-value="allowedUsers" class="font-mono" @update:model-value="(ids) => setAllowedUsers(ids.map(String))">
|
||||
<div role="group" aria-labelledby="channel-allowed-label" class="contents"><TagsInput :model-value="allowedUsers" class="font-mono" @update:model-value="(ids) => setAllowedUsers(ids.map(String))">
|
||||
<TagsInputItem v-for="id in allowedUsers" :key="id" :value="id">
|
||||
<TagsInputItemText />
|
||||
<TagsInputItemDelete />
|
||||
</TagsInputItem>
|
||||
<TagsInputInput placeholder="Add user ID" aria-label="Allowed users" />
|
||||
</TagsInput>
|
||||
</TagsInput></div>
|
||||
</div>
|
||||
</Field>
|
||||
<form.Field v-if="!instance" v-slot="{ field }" name="show_tool_calls">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel>Show tool calls</FieldLabel></FieldContent>
|
||||
<FieldContent><FieldLabel :for="`channel-show-tools-${instance ? 'instance' : 'channel'}`">Show tool calls</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Switch :model-value="field.state.value" aria-label="Show tool calls" @update:model-value="field.handleChange" />
|
||||
<Switch :id="`channel-show-tools-${instance ? 'instance' : 'channel'}`" :model-value="field.state.value" aria-label="Show tool calls" @update:model-value="field.handleChange" />
|
||||
</div>
|
||||
</Field>
|
||||
</form.Field>
|
||||
@@ -246,31 +247,31 @@ function setModels(list: string[]) {
|
||||
orientation="responsive"
|
||||
:class="field.state.value && 'relative isolate before:pointer-events-none before:absolute before:inset-y-0 before:-inset-x-3 before:-z-10 before:rounded-md before:border before:border-danger/40 before:bg-danger-soft'"
|
||||
>
|
||||
<FieldContent><FieldLabel>Unrestricted filesystem</FieldLabel></FieldContent>
|
||||
<FieldContent><FieldLabel for="channel-unrestricted">Unrestricted filesystem</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Switch :model-value="field.state.value" aria-label="Unrestricted filesystem" @update:model-value="field.handleChange" />
|
||||
<Switch id="channel-unrestricted" :model-value="field.state.value" aria-label="Unrestricted filesystem" @update:model-value="field.handleChange" />
|
||||
</div>
|
||||
</Field>
|
||||
</form.Field>
|
||||
<form.Field v-slot="{ field }" name="show_tool_calls">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel>Show tool calls</FieldLabel></FieldContent>
|
||||
<FieldContent><FieldLabel :for="`channel-show-tools-${instance ? 'instance' : 'channel'}`">Show tool calls</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Switch :model-value="field.state.value" aria-label="Show tool calls" @update:model-value="field.handleChange" />
|
||||
<Switch :id="`channel-show-tools-${instance ? 'instance' : 'channel'}`" :model-value="field.state.value" aria-label="Show tool calls" @update:model-value="field.handleChange" />
|
||||
</div>
|
||||
</Field>
|
||||
</form.Field>
|
||||
<form.Field v-slot="{ field }" name="max_steps">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent>
|
||||
<FieldLabel>Max steps</FieldLabel>
|
||||
<FieldLabel for="channel-max-steps">Max steps</FieldLabel>
|
||||
<FieldDescription>0 = default (100).</FieldDescription>
|
||||
</FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<NumberField :model-value="field.state.value" :min="0" class="w-32" @update:model-value="field.handleChange">
|
||||
<NumberFieldContent>
|
||||
<NumberFieldDecrement />
|
||||
<NumberFieldInput class="font-mono" aria-label="Max steps" />
|
||||
<NumberFieldInput id="channel-max-steps" class="font-mono" aria-label="Max steps" />
|
||||
<NumberFieldIncrement />
|
||||
</NumberFieldContent>
|
||||
</NumberField>
|
||||
@@ -279,10 +280,10 @@ function setModels(list: string[]) {
|
||||
</form.Field>
|
||||
<Field orientation="responsive">
|
||||
<FieldContent>
|
||||
<FieldLabel>Rate limit</FieldLabel>
|
||||
<FieldLabel id="channel-rate-label">Rate limit</FieldLabel>
|
||||
<FieldDescription>Per sender. Off while either is 0.</FieldDescription>
|
||||
</FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1" role="group" aria-labelledby="channel-rate-label">
|
||||
<div class="flex flex-wrap items-center gap-2 text-label text-fg-muted">
|
||||
<form.Field v-slot="{ field }" name="rate_limit.max_requests">
|
||||
<NumberField :model-value="field.state.value" :min="0" class="w-28" @update:model-value="field.handleChange">
|
||||
@@ -300,17 +301,17 @@ function setModels(list: string[]) {
|
||||
</Field>
|
||||
<Field orientation="responsive">
|
||||
<FieldContent>
|
||||
<FieldLabel>Models</FieldLabel>
|
||||
<FieldLabel id="channel-models-label">Models</FieldLabel>
|
||||
<FieldDescription>Empty: role models.</FieldDescription>
|
||||
</FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<TagsInput :model-value="models" class="font-mono" @update:model-value="(list) => setModels(list.map(String))">
|
||||
<div role="group" aria-labelledby="channel-models-label" class="contents"><TagsInput :model-value="models" class="font-mono" @update:model-value="(list) => setModels(list.map(String))">
|
||||
<TagsInputItem v-for="model in models" :key="model" :value="model">
|
||||
<TagsInputItemText />
|
||||
<TagsInputItemDelete />
|
||||
</TagsInputItem>
|
||||
<TagsInputInput placeholder="provider/model" aria-label="Models" />
|
||||
</TagsInput>
|
||||
</TagsInput></div>
|
||||
</div>
|
||||
</Field>
|
||||
<form.Field v-slot="{ field }" name="operator">
|
||||
|
||||
@@ -208,6 +208,10 @@ function onKeydown(event: KeyboardEvent): void {
|
||||
rows="1"
|
||||
placeholder="Message Archie"
|
||||
aria-label="Message Archie"
|
||||
role="combobox"
|
||||
aria-controls="slash-palette"
|
||||
:aria-expanded="isCommandMenuOpen && commandMatches.length ? 'true' : 'false'"
|
||||
:aria-activedescendant="isCommandMenuOpen && commandMatches.length ? `slash-palette-option-${commandSelection}` : undefined"
|
||||
class="max-h-40 min-h-11 flex-1 resize-none border-0 bg-transparent! px-0 py-1 text-label focus-visible:ring-0"
|
||||
@input="onInput"
|
||||
@keydown="onKeydown"
|
||||
|
||||
@@ -39,6 +39,7 @@ watch(
|
||||
<template>
|
||||
<div
|
||||
ref="menu"
|
||||
id="slash-palette"
|
||||
role="listbox"
|
||||
aria-label="Commands"
|
||||
class="absolute inset-x-3 bottom-[calc(100%-0.25rem)] z-30 grid max-h-72 gap-0.5 overflow-auto rounded-lg border border-border-strong bg-popover p-1.5 shadow-md"
|
||||
@@ -48,6 +49,7 @@ watch(
|
||||
:key="spec.command"
|
||||
type="button"
|
||||
role="option"
|
||||
:id="`slash-palette-option-${index}`"
|
||||
:aria-selected="index === selection"
|
||||
class="grid grid-cols-[minmax(8rem,14rem)_1fr] items-center gap-2.5 rounded-md border border-transparent px-2.5 py-2 text-left text-fg-muted hover:bg-muted hover:text-foreground aria-selected:border-border aria-selected:bg-muted aria-selected:text-foreground"
|
||||
@mousedown.prevent
|
||||
|
||||
@@ -34,6 +34,7 @@ const { filterState } = useCommand()
|
||||
v-bind="{ ...forwardedProps, ...$attrs }"
|
||||
v-model="filterState.search"
|
||||
data-slot="command-input"
|
||||
aria-label="Filter"
|
||||
auto-focus
|
||||
:class="cn('w-full text-label outline-hidden disabled:cursor-not-allowed disabled:opacity-50', props.class)"
|
||||
/>
|
||||
|
||||
@@ -118,27 +118,27 @@ onMounted(load);
|
||||
|
||||
<form.Field v-slot="{ field }" :name="`${index}.interval`">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel>Interval</FieldLabel></FieldContent>
|
||||
<FieldContent><FieldLabel :for="`curator-${index}-interval`">Interval</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<DurationInput :model-value="field.state.value" :units="['s', 'm', 'h']" @update:model-value="field.handleChange" />
|
||||
<DurationInput :id="`curator-${index}-interval`" :model-value="field.state.value" :units="['s', 'm', 'h']" @update:model-value="field.handleChange" />
|
||||
</div>
|
||||
</Field>
|
||||
</form.Field>
|
||||
|
||||
<form.Field v-slot="{ field }" :name="`${index}.cooldown`">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel>Cooldown</FieldLabel></FieldContent>
|
||||
<FieldContent><FieldLabel :for="`curator-${index}-cooldown`">Cooldown</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<DurationInput :model-value="field.state.value" :units="['s', 'm', 'h']" @update:model-value="field.handleChange" />
|
||||
<DurationInput :id="`curator-${index}-cooldown`" :model-value="field.state.value" :units="['s', 'm', 'h']" @update:model-value="field.handleChange" />
|
||||
</div>
|
||||
</Field>
|
||||
</form.Field>
|
||||
|
||||
<form.Field v-slot="{ field }" :name="`${index}.on_input`">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel>Wake on input</FieldLabel></FieldContent>
|
||||
<FieldContent><FieldLabel :for="`curator-${index}-wake`">Wake on input</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Switch :model-value="field.state.value" :aria-label="`${def.name} wake on input`" @update:model-value="field.handleChange" />
|
||||
<Switch :id="`curator-${index}-wake`" :model-value="field.state.value" :aria-label="`${def.name} wake on input`" @update:model-value="field.handleChange" />
|
||||
</div>
|
||||
</Field>
|
||||
</form.Field>
|
||||
@@ -166,9 +166,9 @@ onMounted(load);
|
||||
|
||||
<form.Field v-slot="{ field }" :name="`${index}.skills`">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel>Skills</FieldLabel></FieldContent>
|
||||
<FieldContent><FieldLabel :for="`curator-${index}-skills`">Skills</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<Switch :model-value="field.state.value" :aria-label="`${def.name} skills`" @update:model-value="field.handleChange" />
|
||||
<Switch :id="`curator-${index}-skills`" :model-value="field.state.value" :aria-label="`${def.name} skills`" @update:model-value="field.handleChange" />
|
||||
</div>
|
||||
</Field>
|
||||
</form.Field>
|
||||
|
||||
@@ -240,9 +240,9 @@ const remove = () =>
|
||||
</form.Field>
|
||||
<form.Field v-slot="{ field }" name="run_retention">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel>Keep runs for</FieldLabel></FieldContent>
|
||||
<FieldContent><FieldLabel for="run-retention">Keep runs for</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<DurationInput :model-value="field.state.value" :units="['h']" @update:model-value="field.handleChange" />
|
||||
<DurationInput id="run-retention" :model-value="field.state.value" :units="['h']" @update:model-value="field.handleChange" />
|
||||
<DraftHint :kind="SETTINGS" path="run_retention" />
|
||||
</div>
|
||||
</Field>
|
||||
|
||||
@@ -96,10 +96,10 @@ const unavailable = computed(() => !!connection.value.type && !extensions.forges
|
||||
/>
|
||||
</SettingRow>
|
||||
<SettingRow label="Credential">
|
||||
<SecretRefField :model-value="connection.token" @update:model-value="(token) => patch({ token })" :id-prefix="`connection-${props.index}-token`" />
|
||||
<div role="group" aria-label="Credential"><SecretRefField :model-value="connection.token" @update:model-value="(token) => patch({ token })" :id-prefix="`connection-${props.index}-token`" /></div>
|
||||
</SettingRow>
|
||||
<SettingRow label="Permitted operations">
|
||||
<div class="w-full space-y-2">
|
||||
<div class="w-full space-y-2" role="group" aria-label="Permitted operations">
|
||||
<div
|
||||
v-for="[identity, operations] in permits(connection)"
|
||||
:key="`${props.index}-${identity}`"
|
||||
|
||||
@@ -129,8 +129,8 @@ function looseNumber(value: string | number): number | string {
|
||||
<FieldGroup class="@container/field-group">
|
||||
<form.Field v-slot="{ field }" name="minimax.api_key_ref">
|
||||
<Field orientation="responsive">
|
||||
<FieldContent><FieldLabel>API key</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1">
|
||||
<FieldContent><FieldLabel id="tools-api-key-label">API key</FieldLabel></FieldContent>
|
||||
<div class="flex min-w-0 flex-wrap items-center gap-3 @md/field-group:flex-1" role="group" aria-labelledby="tools-api-key-label">
|
||||
<SecretRefField
|
||||
:model-value="field.state.value"
|
||||
id-prefix="minimax-key"
|
||||
|
||||
Reference in new issue
Block a user