Skip to content
Back to skills

Build Aria Widget

ASecurity

Implements a combobox, tabs, dialog, menu, disclosure, tree or listbox per the ARIA Authoring Practices pattern, using native elements whenever they suffice. Use for custom interactive widgets.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 26, 2026
ai-agentsjavascriptgojavareacttestingapi

Works with

  • api

Security analysis

A100/100

Scanned November 26, 2026

npx -y skills add hermes-hq/hodios-dist --skill build-aria-widget --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Build Aria Widget?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Build Aria Widget
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hermes-hq-build-aria-widget/badge)](https://www.skillsdirectory.com/skills/hermes-hq-build-aria-widget)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: build-aria-widget
description: Implements a combobox, tabs, dialog, menu, disclosure, tree or listbox per the ARIA Authoring Practices pattern, using native elements whenever they suffice. Use for custom interactive widgets.
license: CC0-1.0
arguments:
  - widget
  - framework
  - existing_code
argument-hint: <widget> [framework] [existing_code]
disable-model-invocation: true
metadata:
  version: 1.0.0
  kind: prompt
  category: accessibility
  source: https://hermes-ide.com/prompts/build-aria-widget
  catalog: 2026.1014.1
---

# Build an accessible ARIA widget

## Inputs

- `widget` (required; one of: combobox, tabs, dialog, menu, disclosure, tree, listbox): The widget pattern to build.
- `framework` (optional; default: react): UI framework or "vanilla" for plain HTML and JavaScript.
- `existing_code` (optional): Current implementation to replace or repair, and how the widget is used. Leave empty to build from scratch.

Arguments fill these in order. If a required value is empty, take it from the user’s message or ask for it once.

<context>
The first rule of ARIA is not to use it when a native element does the job: WebAIM's yearly scans of the top million home pages keep finding more errors on pages that use ARIA than on pages that do not. When a custom widget is justified, it has to match the APG pattern exactly: the roles, the states that update as the user acts, and the keyboard model screen-reader users already know from desktop apps. Half a pattern, such as `role="menu"` without arrow-key support, is worse than plain buttons.
</context>

<task>
Build an accessible $widget in $framework.

Existing code or usage: $existing_code (if empty, build from scratch with a minimal, typical API).

1. **Decide native or custom first,** and state the decision:
   - dialog: use `dialog` with `showModal()`. It provides the top layer, an inert background and Escape for free.
   - disclosure: use `details` and `summary`, or a `button` with `aria-expanded` and `aria-controls`.
   - listbox: use `select` unless options need rich content or multi-select with custom rendering.
   - menu: `role="menu"` is for app-style command menus. For site navigation or a list of links, build a disclosure with links instead, and say so.
   - combobox: a text `input` with a custom popup. `datalist` is acceptable only for simple suggestions.
   - tabs and tree have no native equivalent, so build them custom.
2. If custom, implement the APG pattern completely:
   - The roles and their required owned elements (`tablist` and `tab` with `tabpanel`; `tree`, `treeitem` and `group`; `combobox` and `listbox` with `option`).
   - States kept in sync with the UI: `aria-expanded`, `aria-selected`, `aria-checked`, `aria-activedescendant`, `aria-controls`, and `aria-level`, `aria-setsize` and `aria-posinset` when items are virtualised.
   - Accessible names for the widget and each item.
   - One Tab stop for composite widgets, using roving `tabindex` or `aria-activedescendant`, with the APG keyboard model: arrow keys, Home and End, Escape, Enter and Space, and type-ahead where the pattern specifies it.
   - Focus management on open and close: where focus goes, and where it returns.
3. For tabs, choose automatic or manual activation and justify it (manual when showing a panel is slow). For combobox, implement the ARIA 1.2 pattern, where `role="combobox"` sits on the input itself and `aria-autocomplete` matches the actual behaviour.
4. Reuse the project's existing components and styles. Make focus visible.
5. Write tests that query by role and accessible name (Testing Library style or the framework's equivalent), assert state attributes after interactions, and drive the keyboard model.
</task>

<constraints>
- Do not add ARIA that duplicates native semantics, such as `role="button"` on a `button`.
- Do not use `aria-hidden="true"` on anything focusable.
- If $widget is the wrong pattern for the described use, say so, recommend the right one, and build that instead.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
</constraints>

<output_format>
## Native or custom
The decision and why, in two or three sentences.

## Keyboard
| Key | Context | Result |

## Roles states and properties
| Element | Role | Attributes and when they change |

## Code
Each file in its own code block, headed by its path.

## Tests
Code, then one line per test.

## Manual checks
A short list to verify with NVDA plus Firefox or Chrome, and with VoiceOver plus Safari: what should be announced on focus and after each action.
</output_format>

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.