Navigation Menu
Site navigation made of links and disclosure buttons that open panels of links - on hover with intent, on click and from the keyboard - with an optional shared viewport, an indicator and directional motion.
Basic
A <nav> of disclosure buttons (aria-expanded, aria-controls) and links - not a
role="menu", which is for application menus. Hover a trigger and its content opens after
DelayDuration (200 ms); while one is open the next opens at once. Click, Enter or Space toggles;
↓ opens and moves into the content, where every arrow key moves between the links; Tab from an open
trigger enters it; Escape closes it and returns to the trigger; ← / →, Home and
End move between the top-level items, which are all tab stops too. Pressing outside, focus leaving the menu or
choosing a link closes it.
Viewport, indicator and motion
With a BitBhNavigationMenuViewport the open content is moved into one shared panel, which takes its size
through --bit-bh-navigation-menu-viewport-width / -height and so animates between contents; the
Tab order and the reading order stay those of a content that follows its trigger. Contents get
data-motion="from-start|from-end|to-start|to-end" by where the newly open item is relative to the previous
one, so they slide in from the side they come from. BitBhNavigationMenuIndicator follows the open trigger
through --bit-bh-indicator-left / -width.
Vertical and bound
Orientation="BitBhOrientation.Vertical" makes ↑ / ↓ move between the items and
→ (← in right-to-left) open the content and move into it. @bind-Value holds the open
item's value - null when the menu is closed - so code can open and close it too.