Expand description
MenuList — a themed vertical menu container with keyboard navigation.
MenuList is the dropdown panel used by MenuBar, MenuContext, and
popover-style menus. It provides a themed surface (background, rounded
border, drop shadow) and owns the full keyboard navigation stack:
ArrowUp/Down moves focus, Enter activates, Escape bubbles to the
enclosing overlay host, Home and End jump to the first/last visible item.
Type-ahead search jumps to the next item whose stripped label starts with
the accumulated keystrokes (500 ms reset window by default).
Items are added with .item(widget) (any impl Widget, but typically a
MenuItem); separators with .separator(). Conditional rows use
.item_when(widget, visible_prop) — a hidden row collapses to zero height
and is skipped by keyboard navigation. For very long lists (recent files,
etc.) call .max_visible_items(n) to cap the panel height and wrap the
content in a ScrollArea.
Two knobs shape the surface. .inset(dp) sets the gap between the menu
surface and its rows (default 4 dp; the max_visible_items scroll cap
follows it). .surface_style(style) gives this one list its own
PopoverStyle — frame, fill, shadow — ahead of the theme’s popover slot,
which a ComboBox dropdown shares; other lists are unaffected.
Safe-triangle hover gate. When the pointer leaves a submenu trigger’s
row with the submenu still up, the trigger arms the safe region (the apex
and the cone live in teksilo_core::overlay) and publishes that submenu’s
id on a MenuList-wide shared state, so sibling items can skip their
hover-switch while the cursor travels diagonally toward the submenu.
§Accessibility
Role::Menu, named after what opened it (a MenuBar trigger, the
MenuItem::submenu row, a PopoverButton’s button), with the keyboard
highlight as its active descendant: the menu keeps keyboard focus, and a
screen reader is told of each move of the highlight as a focus change to
the row. Each row is Role::MenuItem / Role::MenuItemCheckBox /
Role::MenuItemRadio as declared by the item, and carries its position
among the menu’s shown rows, whose count the menu carries. Radio items in
the same list also auto-group via push_to_radio_group.
let _w = MenuList::new()
.item(MenuItem::new(lit!("Cut")).on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.cut"))))
.item(MenuItem::new(lit!("Copy")).on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.copy"))))
.separator()
.item(MenuItem::new(lit!("Paste")).on_activate_fn(|ctx| ctx.send_intent(Intent::new("app.paste"))));Structs§
- Menu
List - A themed vertical dropdown menu panel with keyboard navigation and type-ahead.
- Menu
Separator - A 1 dp horizontal divider line between groups of menu items.