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.
Menu-button pattern built on the native Popover API. The menu is a
popoverthe trigger toggles throughpopovertarget, 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/menuitemradiostate, 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 throughonOpenChange/hl:open-changeand activating an item emits a cancelablehl:select. Markup can setdata-hl-placement,data-hl-close-on-select, anddata-hl-default-openon the root.