menuAim()
Keep a submenu open while moving to it.
Try the example
Move diagonally from Products towards the lower links, then try moving directly down. Click a trigger or use Enter to activate immediately.
Products selected
Add it to your project
- Copy the HTML. Place the markup inside the component where this behavior belongs. The preview’s visual classes are website styles; use your own design system.
- Connect the behavior. Copy the JavaScript tab and call its exported
mount(element)after your component’s elements exist. Replace simulated delays and data operations with your own application code. - Clean up. Call the returned cleanup when the component unmounts. It aborts the example’s listeners and releases the helper’s timers, observers or state.
API and lifecycle
Create one instance per sibling submenu group. remember(event) records the pointer on the active trigger; request(event, panel, activate, side, key) delays a competing panel only while the mouse is heading toward the current submenu.
- Interface
delay=300, tolerance=8; remember pointer on active trigger, request on competing trigger movement, cancel on panel entry or exit, destroy on unmount- Lifecycle
- Call cancel() when the pointer enters the panel or leaves the menu. destroy() clears pending work and the remembered pointer. Pass the actual side if the submenu flips position.
Accessibility and safety
Implementation notes
This selects panels, not a complete ARIA menu. Add appropriate dismissal, keyboard and touch behavior. The declarative adapter uses a fixed side; use the programmatic API for placement flips.
This manages pointer timing, not a complete ARIA menu. Click and keyboard activation should bypass the delay; add touch activation, dismissal and correct semantics separately.
What to check
Move diagonally into the submenu, then directly toward another trigger. Check keyboard and tap activation are immediate and test flipped submenu positions.