swarm-ui: an agent card is no longer a button around buttons
The card row had role=button and tabindex=0 and held the terminal button, the wanted menu and the login button, which axe reports as nested interactive controls and which a screen reader can't walk. The row is no control now; the agent's name is a real button, so Tab, Enter and Space open the agent, and a press anywhere on the card still does. Picking stays one checkbox per card.
This commit is contained in:
parent
7e6972a191
commit
c77904362d
1 changed files with 60 additions and 19 deletions
|
|
@ -125,9 +125,13 @@ export function AgentsPage() {
|
|||
if (was === null || selected !== null) return;
|
||||
const inPane = document.activeElement?.closest("[inert]") != null;
|
||||
if (inPane || document.activeElement === document.body) {
|
||||
document
|
||||
.querySelector<HTMLElement>(`[data-agent="${CSS.escape(was)}"]`)
|
||||
?.focus({ preventScroll: true });
|
||||
// The name is the card's tab stop; while picking, the row is.
|
||||
const row = document.querySelector<HTMLElement>(
|
||||
`[data-agent="${CSS.escape(was)}"]`,
|
||||
);
|
||||
(
|
||||
row?.querySelector<HTMLElement>(".ui-agent-card-name-button") ?? row
|
||||
)?.focus({ preventScroll: true });
|
||||
}
|
||||
}, [selected]);
|
||||
// The PUT response is the hive's whole declaration set (every agent's
|
||||
|
|
|
|||
Loading…
Reference in a new issue