sdxc

Type to search, or start from one of these:

[ @sdxc/ui/mixins ]

menuKeys

Why JS.

import { menuKeys } from "@sdxc/ui/mixins";

Usage

Adapts the WAI-ARIA menu keyboard pattern — roving tabindex, arrow-key navigation, Home/End, and typeahead — onto a Menu surface's [role^="menuitem"] descendants; only manages focus, leaving activation to native semantics.

Signature

menuKeys(options?: MenuKeys.Options): MixinDescriptor<HTMLElement>

Returns a mixin descriptor for the Menu surface's mix prop.

Parameters

ParameterTypeDescription
options?MenuKeys.OptionsItem-selector override for non-standard markup.

Examples

<Menu.List mix={menuKeys()}>
	<Menu.Item>Rename</Menu.Item>
	<Menu.Item>Delete</Menu.Item>
</Menu.List>

The events, constants and types its module publishes, each imported from @sdxc/ui/mixins too.

Interface

MenuKeys.Options

Configuration accepted by menuKeys.

MemberTypeDescription
itemSelector?stringSelector, evaluated against the Menu surface's descendants, that identifies its menu items. Defaults to [role^="menuitem"], matching the menuitem, menuitemcheckbox, and menuitemradio roles.

Written by Sergio Xalambrí. Follow @sergiodxa for new packages, or sponsor the work.