Menu-button pattern built on the native Popover API. The menu is a popover the trigger toggles through popovertarget, so opening, closing, Escape, and light-dismiss all work with no JavaScript, and CSS anchor positioning places it. This enhancer adds the menu semantics the platform doesn't: role="menu" wiring, roving focus into the items on open, arrow/Home/End/typeahead navigation that skips disabled items, menuitemcheckbox/menuitemradio state, nested submenus (an item followed by a sibling [role="menu"] opens it with the inline-end arrow, Enter, Space, click, or hover; the inline-start arrow and Escape step back out), focus returned to the trigger when the menu closes from the keyboard or by activating an item, and a JS positioning fallback for engines without anchor positioning. Items added or removed after enhancement are picked up automatically. Open state is observable through onOpenChange/hl:open-change and activating an item emits a cancelable hl:select. Markup can set data-hl-placement, data-hl-close-on-select, and data-hl-default-open on the root.

Properties

Properties