@mocanvas/mocanvas · function
declare function useMenuKeyboard(open: boolean, layerRef: RefObject<HTMLElement | null>): voidRoving focus inside a menu: Up/Down move, Home/End jump, and focus lands on the first item when the menu opens.
A menu whose items cannot be reached with the arrow keys is not a menu — it is a set of buttons that happen to be in a box — so this is wired into every floating layer rather than left to each one.
mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.