Menu
A dropdown menu of actions anchored to a trigger (APG menu pattern). The trigger has data-ts-menu-trigger; the panel has data-ts-menu-panel, with ts menu-item, ts menu-separator, and ts menu-label inside. It’s for running actions, not for choosing a value.
Overlays · TaishoDS Core, in plain HTML.
Examples
One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.
Actions menu
Class reference
Every value of each modifier, with its HTML ready to copy.
Placement
Where the panel anchors relative to the trigger when it opens. Click each one to see it.
When to use
- Grouping secondary actions behind a button (“⋯”, “Options”).
- The actions don’t fit comfortably in the toolbar, but they’re used often.
- Each item does something (navigate, edit, delete) and doesn’t leave a value selected.
When not to use
- You’re choosing a form value that stays selected →
select. - The menu opens with a right-click on some content →
context-menu. - They’re app-wide commands, searchable with ⌘K →
command-palette.
Do
- Group items with
ts menu-labelandts menu-separator, and keep destructive actions apart and at the end. - The trigger needs an accessible name (text or
aria-label).
Don’t
- Don’t put a form inside. It’s a list of actions, not a panel →
popover. - Don’t hide the screen’s primary action inside a menu.
TaishoDS Core
Needs Core’s JS, which handles focus, keyboard, and state.
The Popover API shows the menu, but doesn’t navigate it. The keyboard and submenus are Core’s.
Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.
data-ts-menudata-ts-menu-paneldata-ts-menu-triggerdata-ts-value
What it does: The APG menu pattern—programmatic focus on the items (tabindex="-1"), ↑ ↓, Home and End, Tab to close, opening submenus, and cascading close.
From the CDN, without a build, load taisho.menu.css along with taisho.base.css. Also load:
taisho.separator.css
For how Core works in general, see Behavior.
Accessibility
Implements the Menu Button pattern from the WAI-ARIA APG.
- The trigger exposes
aria-haspopup="menu"andaria-expanded. - Items have
tabindex="-1". They receive focus programmatically, not with Tab. ← → don’t move focus in a vertical menu. - It opens with Enter, Space, or ↓ from the trigger. Inside, ↑ and ↓ navigate (wrapping), Enter selects, and Esc closes and returns focus to the trigger.
Keyboard
On top of what the browser already does (Tab moves focus, Enter activates a button).
| Key | What it does |
|---|---|
| ↑↓ | Move through the items. |
| Enter/Space | Activates the focused item. |
| Home/End | Goes to the first / last item. |
| Tab | Closes the menu, and focus moves on to the next element on the page (it doesn’t move through the items). |
| Esc | Closes and returns focus to the trigger. |
Verification
What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.
- axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
- keyboard Key map documented above, checked against the component.
- screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.